mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] can: flexcan: Fix OF node reference leak in flexcan_setup_stop_mode_gpr()
@ 2026-09-17  9:53 Wentao Liang
  2026-09-17 10:01 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17  9:53 UTC (permalink / raw)
  To: davem; +Cc: linux-can, linux-kernel, mailhol, mkl, Wentao Liang, stable

of_find_node_by_phandle() takes a reference on the GPR node and the
error path releases it through out_put_node.  The success path returns
before reaching that label, so the reference is leaked every time the
stop mode is set up successfully, and the node can never be freed.

Release the node reference before returning.

Fixes: 13dfb3fa4943 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
Cc: stable@vger.kernel.org
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 f5d22c61503f..68699d674fc3 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-09-17 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17  9:53 [PATCH] can: flexcan: Fix OF node reference leak in flexcan_setup_stop_mode_gpr() Wentao Liang
2026-09-17 10:01 ` Marc Kleine-Budde

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®