mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: sunplus: spl2sw: fix OF node leak in spl2sw_probe()
@ 2026-11-27  7:42 zhaofeng2
  2026-11-27  7:49 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: zhaofeng2 @ 2026-11-27  7:42 UTC (permalink / raw)
  To: Wells Lu; +Cc: Zhao Feng, netdev, linux-kernel

From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>

spl2sw_probe() calls of_get_child_by_name() to obtain the
"ethernet-ports" child node and uses it as the parent for
spl2sw_get_eth_child_node() in a loop, but never releases
the reference, leaking it on every probe (and on every
goto error path).

Drop the reference with of_node_put() once the node is no
longer needed.

Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
---
Verified against current tree. Leak found by code inspection
(OF reference-counting audit of spl2sw_probe()).

 net/ethernet/sunplus/spl2sw.c | 2 +--++
 1 file changed, 2 insertions(+), 0 deletion(-)

--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -471,6 +471,8 @@
 		spl2sw_mac_rx_mode_set(mac);
 	}
 
+	of_node_put(eth_ports_np);
+
 	/* Find first valid net device. */
 	for (i = 0; i < MAX_NETDEV_NUM; i++) {
 		if (comm->ndev[i])



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

end of thread, other threads:[~2026-11-27  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  7:42 [PATCH] net: ethernet: sunplus: spl2sw: fix OF node leak in spl2sw_probe() zhaofeng2
2026-11-27  7:49 ` netdev-bot+sinfo

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®