* [PATCH] clk: si5341: Fix NULL pointer dereference in probe
@ 2026-08-25 8:59 Yang Zi
2026-08-25 15:58 ` Brian Masney
0 siblings, 1 reply; 2+ messages in thread
From: Yang Zi @ 2026-08-25 8:59 UTC (permalink / raw)
To: bmasney, sboyd, mturquette; +Cc: linux-clk, linux-kernel
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>
---
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: si5341: Fix NULL pointer dereference in probe
2026-08-25 8:59 [PATCH] clk: si5341: Fix NULL pointer dereference in probe Yang Zi
@ 2026-08-25 15:58 ` Brian Masney
0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-08-25 15:58 UTC (permalink / raw)
To: Yang Zi; +Cc: sboyd, mturquette, linux-clk, linux-kernel
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;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-25 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 8:59 [PATCH] clk: si5341: Fix NULL pointer dereference in probe Yang Zi
2026-08-25 15:58 ` Brian Masney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox