mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] can: flexcan: fix device node reference leak in stop mode setup
@ 2026-11-03 10:05 Wentao Liang
  2026-11-03 10:26 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-11-03 10:05 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Jakub Kicinski, Siddharth Vadapalli
  Cc: linux-can, linux-kernel, Wentao Liang, stable

of_find_node_by_phandle() returns a device node with an incremented
reference count. flexcan_setup_stop_mode_gpr() drops it only when
syscon_node_to_regmap() fails, so a successful probe of a controller
using the GPR stop mode leaks one reference on the GPR node.

Release the reference on the success path as well.

Fixes: de3578c198c6 ("can: flexcan: add self wakeup support")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/can/flexcan/flexcan-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 86b40abe9e76..30ae7c344a05 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -1986,6 +1986,7 @@ static int flexcan_setup_stop_mode_gpr(struct platform_device *pdev)
 		"gpr %s req_gpr=0x02%x req_bit=%u\n",
 		gpr_np->full_name, priv->stm.req_gpr, priv->stm.req_bit);
 
+	of_node_put(gpr_np);
 	return 0;
 
 out_put_node:
-- 
2.34.1


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

end of thread, other threads:[~2026-11-03 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:05 [PATCH] can: flexcan: fix device node reference leak in stop mode setup Wentao Liang
2026-11-03 10:26 ` Krzysztof Kozlowski

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®