The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Yang Zi <2959243019@qq.com>
Cc: sboyd@kernel.org, mturquette@baylibre.com,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: si5341: Fix NULL pointer dereference in probe
Date: Tue, 25 Aug 2026 11:58:25 -0400	[thread overview]
Message-ID: <ao27oVjo2svicHc8@redhat.com> (raw)
In-Reply-To: <tencent_CF54C6DBF6CC64E627F5231BD1CB408C2F05@qq.com>

Hi Yang,

On Tue, Aug 25, 2026 at 04:59:56PM +0800, Yang Zi wrote:
> si5341_probe() dereferences client->dev.of_node->name without first
> checking that a device tree node is present. When the device is
> instantiated without DT, e.g. via sysfs "new_device", client->dev.of_node
> is NULL and probe crashes with a NULL pointer dereference.
> 
> Add an early check and return -ENODEV when no of_node is available, since
> this driver requires device tree bindings.
> 
> Signed-off-by: Yang Zi <2959243019@qq.com>

This patch doesn't apply against linux-next. Otherwise the change looks
fine to me.

Brian


> ---
>  drivers/clk/clk-si5341.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
> index 2499b771cd83..9d901c2fd0df 100644
> --- a/drivers/clk/clk-si5341.c
> +++ b/drivers/clk/clk-si5341.c
> @@ -1567,6 +1567,9 @@ static int si5341_probe(struct i2c_client *client)
>      bool initialization_required;
>      u32 status;
>  
> +    if (!client->dev.of_node)
> +        return -ENODEV;
> +
>      data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
>      if (!data)
>          return -ENOMEM;
> 
> 


      reply	other threads:[~2026-08-25 15:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  8:59 [PATCH] clk: si5341: Fix NULL pointer dereference in probe Yang Zi
2026-08-25 15:58 ` Brian Masney [this message]

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=ao27oVjo2svicHc8@redhat.com \
    --to=bmasney@redhat.com \
    --cc=2959243019@qq.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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