mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux
@ 2026-05-23  8:07 Wentao Liang
  2026-05-23 10:12 ` Markus Elfring
  2026-05-26  9:42 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-05-23  8:07 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Wentao Liang, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux
  2026-05-23  8:07 [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux Wentao Liang
@ 2026-05-23 10:12 ` Markus Elfring
  2026-05-26  9:42 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-05-23 10:12 UTC (permalink / raw)
  To: vulab, linux-gpio, Linus Walleij; +Cc: stable, LKML

> 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

                                                       call?


> before the early return path.

Please avoid a bit of duplicate source code in the mentioned function implementation.

How do you think about to reconsider involved identifiers once more?
https://elixir.bootlin.com/linux/v7.1-rc4/source/drivers/pinctrl/pinconf-generic.c

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux
  2026-05-23  8:07 [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux Wentao Liang
  2026-05-23 10:12 ` Markus Elfring
@ 2026-05-26  9:42 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-05-26  9:42 UTC (permalink / raw)
  To: Wentao Liang; +Cc: linus.walleij, linux-gpio, linux-kernel, stable

On Sat, May 23, 2026 at 10:08 AM Wentao Liang <vulab@iscas.ac.cn> wrote:

> 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>

The code you're patching has been refactored, rebase you changes on the
pinctrl "devel" branch please.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-26  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-23  8:07 [PATCH] pinctrl: pinconf-generic: fix of_node reference count leak in dt_node_to_map_pinmux Wentao Liang
2026-05-23 10:12 ` Markus Elfring
2026-05-26  9:42 ` Linus Walleij

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®