Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1028227ybs; Mon, 25 May 2020 05:34:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK1JoB1rsks1DZRQBMz1JZpIz6K4+ra1Vv3OcY0mryBG2M9MgxgZZYUSI84nCzKEiEZrnS X-Received: by 2002:a05:6402:1d98:: with SMTP id dk24mr14451053edb.206.1590410068099; Mon, 25 May 2020 05:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590410068; cv=none; d=google.com; s=arc-20160816; b=kkhqmwRi9PH8QKuqmQTTgUC4UyJP/kpgVV0A/dE3L85n2MZzbhyMSrLdZol+efvdsr +dGrSbXP0/Ca7BM0OuTUwEWUIZpTPCVpVhwWDB0vL3SzWmVwsEVgQNMW3E6LlR1GRts0 kq3Cjh2e/KseXKHBdOFq4ozGIL/r6uIhRCNaN3SKaWwptFzwMs0tcNBAt/ApKGOKrIsU eBpAk1dQBWGcQQUuCWNrh/nM613tDEXj7VRowQkCV54zuvxyrMEdKghfCuA31eO3kpmN FxsFE1snRb+DskS0CiQ05xFv10dzt6uajW7oaGuj0auIl6onXVSD0DWANeCR+v10zhq3 qhGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4brhUMvajhqCMbsLZet6vC1Qy3ztqFVBNLV1y3fJ0Ok=; b=Hy6RztZ90hC4oolrlYbv6WwIWMAtvNbryRuPpg81vZ6V1SN7mqHliU0vzTxJnOb9/h xuy+xzfo7UdF6uE8DmeUoTHqzFARcP8Eg5Rn4EbYu7jv4kp24pD1bWHpzhBjdH3B9SQl nZ32aSstBpauCVlobPFrKCdXRjzZMmWsBbVHlYrnDFtdmyI0gt64v7odDzKqSsbj4GEc wZy2olMRcdhzxtS2hN1yDG2V0ncI6gypPBAemGaXFUfFwAPpHfqX1oMk16GdrpKRSVYX 05BC4EGNo+2Nemv9jY8rUBz2lResrmvHoSLJgzyfG1lAPHmTpKwCYzal3OIXsGq/kCt6 JOsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hnhOWAjq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj21si8713055ejb.713.2020.05.25.05.34.03; Mon, 25 May 2020 05:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hnhOWAjq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390601AbgEYM2x (ORCPT + 99 others); Mon, 25 May 2020 08:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390505AbgEYM2w (ORCPT ); Mon, 25 May 2020 08:28:52 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 056C9C08C5C1 for ; Mon, 25 May 2020 05:28:52 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id l21so20309208eji.4 for ; Mon, 25 May 2020 05:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4brhUMvajhqCMbsLZet6vC1Qy3ztqFVBNLV1y3fJ0Ok=; b=hnhOWAjqAv1GZGWkwmr90o7yeD20DdB7e42yX7ajg/ZCxiJyFkeAtysH96F8mWj0a5 qEFDLtEu+h64FvqQnCfWlsaHd7VhN7vI5fg/UDW8ngyxV4/2boMBDLWOkkSzWgBV1vEH zAGhmm2uShjKSYCQN2/RgtBN47hewG1wCB47Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4brhUMvajhqCMbsLZet6vC1Qy3ztqFVBNLV1y3fJ0Ok=; b=tzYJKAFvbuXxOMMre1F5I8J4hMrFCCC3/uYHHmhjALFXlP2A4grV1jbqKAR0gV0a9A 2w3gmz49lvQCciGrfTAnP4m7SA3o2MJvbrTQvKG+l+xfLvKizET+VjB4FVgnS/Uj1UTB BEHsP/qHE3qpXr0L/4BKYk8XJUBZY2JOYMxVvzu3DyxnWFtXZd6Wp2MvAw8HKBtO0Gq3 /EOZKc1id9dMKSht1A58QKsdv+XE5uITKDPo8yzQNJCEL+uGgME51T/Px1roeBj26SU1 eZFNF3HgTp/Giqtc0cjiXG0pPE5kbTUYt+IVwaUkuy8c4mp6SYjFB9X6JSZyjPiZ+Bq7 rbtA== X-Gm-Message-State: AOAM532ODRo0VJjAzJxVjtZN3E5R0AP1GW4TP+U480Saa9f6/iW4N/OR mXVcmL2MD+XTVbdWTwI9+3L6q9x4wq5HxA== X-Received: by 2002:a17:906:f103:: with SMTP id gv3mr18033896ejb.226.1590409730430; Mon, 25 May 2020 05:28:50 -0700 (PDT) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com. [209.85.221.46]) by smtp.gmail.com with ESMTPSA id g61sm15861614ede.96.2020.05.25.05.28.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 May 2020 05:28:49 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id e1so16921723wrt.5 for ; Mon, 25 May 2020 05:28:49 -0700 (PDT) X-Received: by 2002:a5d:66c5:: with SMTP id k5mr14649696wrw.17.1590409728561; Mon, 25 May 2020 05:28:48 -0700 (PDT) MIME-Version: 1.0 References: <20200522101327.13456-1-m.szyprowski@samsung.com> <34736047-3fc8-385b-cdea-79b061deb7b4@samsung.com> In-Reply-To: <34736047-3fc8-385b-cdea-79b061deb7b4@samsung.com> From: Tomasz Figa Date: Mon, 25 May 2020 14:28:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] i2c: core: fix NULL pointer dereference in suspend/resume callbacks To: Marek Szyprowski , Bibby Hsieh Cc: Linux PM , linux-i2c , Linux Kernel Mailing List , Wolfram Sang , Bartosz Golaszewski , srv_heupstream , Bartlomiej Zolnierkiewicz , linux-samsung-soc Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, On Fri, May 22, 2020 at 1:15 PM Marek Szyprowski wrote: > > Hi All, > > On 22.05.2020 12:13, Marek Szyprowski wrote: > > Commit 6fe12cdbcfe3 ("i2c: core: support bus regulator controlling in > > adapter") added generic suspend and resume functions for i2c devices. > > Those functions unconditionally access an i2c_client structure assigned > > to the given i2c device. However, there exist i2c devices in the system > > without a valid i2c_client. Add the needed check before accessing the > > i2c_client. > > Just one more comment. The devices without i2c_client structure are the > i2c 'devices' associated with the respective i2c bus. They are visible > in /sys: > > ls -l /sys/bus/i2c/devices/i2c-* > > I wonder if this patch has been ever tested with system suspend/resume, > as those devices are always available in the system... Sorry for the trouble and thanks a lot for the fix. We'll make sure to do more thorough testing, including suspend/resume before relanding this change. Since the patch was reverted, can we squash your fix with the next revision together with your Co-developed-by and Signed-off-by tags? Best regards, Tomasz