Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register()
@ 2026-05-07 14:20 Shitalkumar Gandhi
  2026-05-10 17:20 ` patchwork-bot+netdevbpf
  2026-05-10 18:41 ` Simon Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Shitalkumar Gandhi @ 2026-05-07 14:20 UTC (permalink / raw)
  To: Iyappan Subramanian, Keyur Chudgar, Quan Nguyen
  Cc: Jakub Kicinski, David S . Miller, Eric Dumazet, Paolo Abeni,
	Andrew Lunn, Simon Horman, netdev, linux-kernel,
	Shitalkumar Gandhi

The for_each_child_of_node() loop captures mdio_np via break,
holding the refcount. of_mdiobus_register() does not consume the
reference, so it leaks on success.

Put it after registration.

Fixes: e6ad767305eb ("drivers: net: Add APM X-Gene SoC ethernet driver support.")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index b854b6b42d77..2926e1e59941 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -910,7 +910,9 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
 			return -ENXIO;
 		}
 
-		return of_mdiobus_register(mdio, mdio_np);
+		ret = of_mdiobus_register(mdio, mdio_np);
+		of_node_put(mdio_np);
+		return ret;
 	}
 
 	/* Mask out all PHYs from auto probing. */
-- 
2.25.1


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

* Re: [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register()
  2026-05-07 14:20 [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register() Shitalkumar Gandhi
@ 2026-05-10 17:20 ` patchwork-bot+netdevbpf
  2026-05-10 18:41 ` Simon Horman
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-10 17:20 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: iyappan, keyur, quan, kuba, davem, edumazet, pabeni,
	andrew+netdev, horms, netdev, linux-kernel, shitalkumar.gandhi

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  7 May 2026 19:50:24 +0530 you wrote:
> The for_each_child_of_node() loop captures mdio_np via break,
> holding the refcount. of_mdiobus_register() does not consume the
> reference, so it leaks on success.
> 
> Put it after registration.
> 
> Fixes: e6ad767305eb ("drivers: net: Add APM X-Gene SoC ethernet driver support.")
> Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
> 
> [...]

Here is the summary with links:
  - [net] net: xgene: fix mdio_np leak in xgene_mdiobus_register()
    https://git.kernel.org/netdev/net/c/a450063ef86b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register()
  2026-05-07 14:20 [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register() Shitalkumar Gandhi
  2026-05-10 17:20 ` patchwork-bot+netdevbpf
@ 2026-05-10 18:41 ` Simon Horman
  2026-05-10 18:42   ` Simon Horman
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2026-05-10 18:41 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: Iyappan Subramanian, Keyur Chudgar, Quan Nguyen, Jakub Kicinski,
	David S . Miller, Eric Dumazet, Paolo Abeni, Andrew Lunn, netdev,
	linux-kernel, Shitalkumar Gandhi

On Thu, May 07, 2026 at 07:50:24PM +0530, Shitalkumar Gandhi wrote:
> The for_each_child_of_node() loop captures mdio_np via break,
> holding the refcount. of_mdiobus_register() does not consume the
> reference, so it leaks on success.
> 
> Put it after registration.
> 
> Fixes: e6ad767305eb ("drivers: net: Add APM X-Gene SoC ethernet driver support.")
> Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>

Reviewed-by: Simon Horman <horms@kernel.org>

FTR: There is an AI-generated review of this patch which you may
     want to look at for possible follow-up. I do not believe it
     should block progress of this patch.

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

* Re: [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register()
  2026-05-10 18:41 ` Simon Horman
@ 2026-05-10 18:42   ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-05-10 18:42 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: Iyappan Subramanian, Keyur Chudgar, Quan Nguyen, Jakub Kicinski,
	David S . Miller, Eric Dumazet, Paolo Abeni, Andrew Lunn, netdev,
	linux-kernel, Shitalkumar Gandhi

On Sun, May 10, 2026 at 07:41:27PM +0100, Simon Horman wrote:
> On Thu, May 07, 2026 at 07:50:24PM +0530, Shitalkumar Gandhi wrote:
> > The for_each_child_of_node() loop captures mdio_np via break,
> > holding the refcount. of_mdiobus_register() does not consume the
> > reference, so it leaks on success.
> > 
> > Put it after registration.
> > 
> > Fixes: e6ad767305eb ("drivers: net: Add APM X-Gene SoC ethernet driver support.")
> > Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> 
> FTR: There is an AI-generated review of this patch which you may
>      want to look at for possible follow-up. I do not believe it
>      should block progress of this patch.

       I meant to mention that the AI-generated review I'm referring
       to is available on sashiko.dev.

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

end of thread, other threads:[~2026-05-10 18:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 14:20 [PATCH net] net: xgene: fix mdio_np leak in xgene_mdiobus_register() Shitalkumar Gandhi
2026-05-10 17:20 ` patchwork-bot+netdevbpf
2026-05-10 18:41 ` Simon Horman
2026-05-10 18:42   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox