mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: macb: Fix mdio_np reference leak in macb_mii_init()
@ 2026-09-17 10:52 Wentao Liang
  2026-09-17 11:59 ` Théo Lebrun
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 10:52 UTC (permalink / raw)
  To: andrew+netdev
  Cc: conor.dooley, davem, edumazet, kuba, linux-kernel, netdev,
	o.rempel, pabeni, theo.lebrun, Wentao Liang, stable

of_get_child_by_name() returns a device node with an elevated reference
count. macb_mii_init() drops it on the error paths via err_out, but the
success path returns 0 without calling of_node_put(), leaking a
reference to the "mdio" child node on every successful probe.

Release the reference before returning on the success path.

Fixes: 8a6631f1cece ("net: macb: avoid redundant lookup for "mdio" child node in MDIO setup")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/ethernet/cadence/macb_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a12aa21244e8..0c4775d51263 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1164,6 +1164,8 @@ static int macb_mii_init(struct macb *bp)
 	if (err)
 		goto err_out_unregister_bus;
 
+	of_node_put(mdio_np);
+
 	return 0;
 
 err_out_unregister_bus:
-- 
2.34.1


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

end of thread, other threads:[~2026-09-17 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 10:52 [PATCH] net: macb: Fix mdio_np reference leak in macb_mii_init() Wentao Liang
2026-09-17 11:59 ` Théo Lebrun

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®