From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
"Yuanjun Gong" <ruc_gongyuanjun@163.com>
Cc: "Andi Shyti" <andi.shyti@kernel.org>, <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH 1/1] drivers/i2c: fix a potential null pointer dereference
Date: Wed, 14 May 2025 11:31:57 +0200 [thread overview]
Message-ID: <D9VS2G7S3T9Q.26QDCDRTC2S11@bootlin.com> (raw)
In-Reply-To: <CACRpkdb6-cjyvXornKcVrYSRqJLE3LqtzotwapHwrYGVm4RNDw@mail.gmail.com>
Hello Linus, Yuanjun,
On Wed May 14, 2025 at 12:10 AM CEST, Linus Walleij wrote:
> On Tue, May 13, 2025 at 2:38 PM Yuanjun Gong <ruc_gongyuanjun@163.com> wrote:
>
>> Add check to *priv to make sure the input *dev is not NULL,
>> and to avoid a potential null pointer dereference.
>>
>> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
>
> Why is this a problem? Reading nmk_i2c_probe():
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> return -ENOMEM;
>
> OK so priv is not NULL.
>
> amba_set_drvdata(adev, priv);
>
> It is unconditionally assigned to the AMBA device.
>
> Surely runtime resume isn't called before probe() has commenced
> successfully?
>
> I don't understand when this condition can occur.
>
> Also including Theo on this, he is the major industrial user of this driver now.
Thanks for the Cc; I agree with your reading of the code and don't see
the issue.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-05-14 9:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 12:37 [PATCH 1/1] drivers/i2c: fix a potential null pointer dereference Yuanjun Gong
2025-05-13 22:10 ` Linus Walleij
2025-05-14 9:31 ` Théo Lebrun [this message]
2025-05-14 15:05 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D9VS2G7S3T9Q.26QDCDRTC2S11@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=andi.shyti@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=ruc_gongyuanjun@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox