From: Wentao Liang <vulab@iscas.ac.cn>
To: linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux
Date: Sat, 23 May 2026 08:07:58 +0000 [thread overview]
Message-ID: <20260523080758.1375830-1-vulab@iscas.ac.cn> (raw)
of_get_parent() acquires a reference on pnode, but the reference is never
released on any return path. Add of_node_put(pnode) in the exit label and
before the early return path.
Cc: stable@vger.kernel.org
Fixes: 7112c05fff83 ("pinctrl: pinconf-generic: Add API for pinmux propertity in DTS file")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/pinctrl/pinconf-generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index d67838afb085..a5016f522889 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -390,6 +390,7 @@ int pinconf_generic_dt_node_to_map_pinmux(struct pinctrl_dev *pctldev,
&num_configs);
if (ret < 0) {
dev_err(dev, "%pOF: could not parse node property\n", np);
+ of_node_put(pnode);
return ret;
}
@@ -420,6 +421,7 @@ int pinconf_generic_dt_node_to_map_pinmux(struct pinctrl_dev *pctldev,
kfree(configs);
if (ret)
pinctrl_utils_free_map(pctldev, *map, *num_maps);
+ of_node_put(pnode);
return ret;
}
--
2.34.1
next reply other threads:[~2026-05-23 8:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 8:07 Wentao Liang [this message]
2026-05-23 10:12 ` Markus Elfring
2026-05-26 9:42 ` Linus Walleij
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=20260523080758.1375830-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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®