From: Wentao Liang <vulab@iscas•ac.cn>
To: Sudeep Holla <sudeep.holla@kernel•org>,
Liam Girdwood <lgirdwood@gmail•com>,
Mark Brown <broonie@kernel•org>
Cc: Cristian Marussi <cristian.marussi@arm•com>,
arm-scmi@vger•kernel.org, linux-arm-kernel@lists•infradead.org,
linux-kernel@vger•kernel.org, Wentao Liang <vulab@iscas•ac.cn>,
stable@vger•kernel.org
Subject: [PATCH v2] regulator: scmi: fix of_node refcount leak in scmi_regulator_probe()
Date: Wed, 27 May 2026 10:48:50 +0000 [thread overview]
Message-ID: <20260527104850.872415-1-vulab@iscas.ac.cn> (raw)
scmi_regulator_probe() calls of_find_node_by_name() which takes a
reference on the returned device node. On the error path where
process_scmi_regulator_of_node() fails, the function returns without
calling of_node_put() on the child node, leaking the reference.
Add of_node_put(np) on the error path to properly release the
reference.
Cc: stable@vger•kernel.org
Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
Signed-off-by: Wentao Liang <vulab@iscas•ac.cn>
---
Change in v2:
- fix typo in code
---
drivers/regulator/scmi-regulator.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
index 6d609c42e479..c005e65ba0ec 100644
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -345,8 +345,10 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
for_each_child_of_node_scoped(np, child) {
ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo);
/* abort on any mem issue */
- if (ret == -ENOMEM)
+ if (ret == -ENOMEM) {
+ of_node_put(np);
return ret;
+ }
}
of_node_put(np);
/*
--
2.34.1
next reply other threads:[~2026-05-27 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 10:48 Wentao Liang [this message]
2026-06-02 15:06 ` [PATCH v2] regulator: scmi: fix of_node refcount leak in scmi_regulator_probe() Mark Brown
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=20260527104850.872415-1-vulab@iscas.ac.cn \
--to=vulab@iscas$(echo .)ac.cn \
--cc=arm-scmi@vger$(echo .)kernel.org \
--cc=broonie@kernel$(echo .)org \
--cc=cristian.marussi@arm$(echo .)com \
--cc=lgirdwood@gmail$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=stable@vger$(echo .)kernel.org \
--cc=sudeep.holla@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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