]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dpaa2-switch: put MAC endpoint device on disconnect
authorGuangshuo Li <lgs201920130244@gmail.com>
Wed, 8 Jul 2026 11:10:25 +0000 (19:10 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 21 Jul 2026 10:17:32 +0000 (12:17 +0200)
fsl_mc_get_endpoint() returns the MAC endpoint device with a reference
taken through device_find_child(). The switch port 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 closes the MAC and frees 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 before freeing the dpaa2_mac object.

Fixes: 84cba72956fd ("dpaa2-switch: integrate the MAC endpoint support")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260708111025.749311-1-lgs201920130244@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c

index 858ba844ac516487efe9add18669268977fbefe9..dd4f60031d0cfde6303945ccc8280618a9144b4f 100644 (file)
@@ -1560,6 +1560,7 @@ static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv)
                dpaa2_mac_disconnect(mac);
 
        dpaa2_mac_close(mac);
+       put_device(&mac->mc_dev->dev);
        kfree(mac);
 }