From: Yang Zi <2959243019@qq.com>
To: bmasney@redhat.com, sboyd@kernel.org, mturquette@baylibre.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] clk: si5341: Fix NULL pointer dereference in probe
Date: Tue, 25 Aug 2026 16:59:56 +0800 [thread overview]
Message-ID: <tencent_CF54C6DBF6CC64E627F5231BD1CB408C2F05@qq.com> (raw)
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;
next reply other threads:[~2026-08-25 9:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 8:59 Yang Zi [this message]
2026-08-25 15:58 ` Brian Masney
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=tencent_CF54C6DBF6CC64E627F5231BD1CB408C2F05@qq.com \
--to=2959243019@qq.com \
--cc=bmasney@redhat.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
all inboxes | Powered by JetHome®