* [PATCH] dpaa2-eth: put MAC endpoint device on disconnect
@ 2026-07-08 11:17 Guangshuo Li
2026-07-13 12:09 ` Ioana Ciornei
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Guangshuo Li @ 2026-07-08 11:17 UTC (permalink / raw)
To: Ioana Ciornei, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
Cc: Guangshuo Li
fsl_mc_get_endpoint() returns the MAC endpoint device with a reference
taken through device_find_child(). The Ethernet connect path stores that
device in mac->mc_dev and keeps it for the lifetime of the connected MAC
object.
However, the disconnect path only disconnects and closes the MAC before
freeing the dpaa2_mac object. It does not drop the endpoint device
reference stored in mac->mc_dev, so every successful connect leaks that
device reference when the MAC is later disconnected.
Drop the endpoint device reference after closing the MAC and before
freeing the dpaa2_mac object.
Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 9335703768a9..764d2a09668f 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4732,6 +4732,7 @@ static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv)
dpaa2_mac_disconnect(mac);
dpaa2_mac_close(mac);
+ put_device(&mac->mc_dev->dev);
kfree(mac);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dpaa2-eth: put MAC endpoint device on disconnect
2026-07-08 11:17 [PATCH] dpaa2-eth: put MAC endpoint device on disconnect Guangshuo Li
@ 2026-07-13 12:09 ` Ioana Ciornei
2026-07-13 12:10 ` Ioana Ciornei
2026-07-21 10:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ioana Ciornei @ 2026-07-13 12:09 UTC (permalink / raw)
To: Guangshuo Li
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Wed, Jul 08, 2026 at 07:17:37PM +0800, Guangshuo Li wrote:
> fsl_mc_get_endpoint() returns the MAC endpoint device with a reference
> taken through device_find_child(). The Ethernet connect path stores that
> device in mac->mc_dev and keeps it for the lifetime of the connected MAC
> object.
>
> However, the disconnect path only disconnects and closes the MAC before
> freeing the dpaa2_mac object. It does not drop the endpoint device
> reference stored in mac->mc_dev, so every successful connect leaks that
> device reference when the MAC is later disconnected.
>
> Drop the endpoint device reference after closing the MAC and before
> freeing the dpaa2_mac object.
>
> Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Next time, please mention the targeted tree (net-next vs net).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dpaa2-eth: put MAC endpoint device on disconnect
2026-07-08 11:17 [PATCH] dpaa2-eth: put MAC endpoint device on disconnect Guangshuo Li
2026-07-13 12:09 ` Ioana Ciornei
@ 2026-07-13 12:10 ` Ioana Ciornei
2026-07-21 10:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ioana Ciornei @ 2026-07-13 12:10 UTC (permalink / raw)
To: Guangshuo Li
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel
On Wed, Jul 08, 2026 at 07:17:37PM +0800, Guangshuo Li wrote:
> fsl_mc_get_endpoint() returns the MAC endpoint device with a reference
> taken through device_find_child(). The Ethernet connect path stores that
> device in mac->mc_dev and keeps it for the lifetime of the connected MAC
> object.
>
> However, the disconnect path only disconnects and closes the MAC before
> freeing the dpaa2_mac object. It does not drop the endpoint device
> reference stored in mac->mc_dev, so every successful connect leaks that
> device reference when the MAC is later disconnected.
>
> Drop the endpoint device reference after closing the MAC and before
> freeing the dpaa2_mac object.
>
> Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dpaa2-eth: put MAC endpoint device on disconnect
2026-07-08 11:17 [PATCH] dpaa2-eth: put MAC endpoint device on disconnect Guangshuo Li
2026-07-13 12:09 ` Ioana Ciornei
2026-07-13 12:10 ` Ioana Ciornei
@ 2026-07-21 10:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-21 10:30 UTC (permalink / raw)
To: Guangshuo Li
Cc: ioana.ciornei, andrew+netdev, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 8 Jul 2026 19:17:37 +0800 you wrote:
> fsl_mc_get_endpoint() returns the MAC endpoint device with a reference
> taken through device_find_child(). The Ethernet connect path stores that
> device in mac->mc_dev and keeps it for the lifetime of the connected MAC
> object.
>
> However, the disconnect path only disconnects and closes the MAC before
> freeing the dpaa2_mac object. It does not drop the endpoint device
> reference stored in mac->mc_dev, so every successful connect leaks that
> device reference when the MAC is later disconnected.
>
> [...]
Here is the summary with links:
- dpaa2-eth: put MAC endpoint device on disconnect
https://git.kernel.org/netdev/net/c/b4b201cc93ff
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
end of thread, other threads:[~2026-07-21 10:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 11:17 [PATCH] dpaa2-eth: put MAC endpoint device on disconnect Guangshuo Li
2026-07-13 12:09 ` Ioana Ciornei
2026-07-13 12:10 ` Ioana Ciornei
2026-07-21 10:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.