net: dpaa2: ptp: fix device node reference leak on remove
PATCH 1/1 net: dpaa2: ptp: fix device node reference leak on remove
dpaa2_ptp_probe() gets a referenced device node with of_find_compatible_node() and stores it in dev->of_node.
The probe failure paths release this reference with of_node_put(). However, after a successful probe, dpaa2_ptp_remove() tears down the PTP and MC resources without dropping the device node reference.
Release dev->of_node during driver removal and clear the pointer after dropping the reference.
This issue was found by manual code inspection.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c +2 -0
@@ -232,6 +232,8 @@ static void dpaa2_ptp_remove(struct fsl_mc_device *mc_dev)fsl_mc_free_irqs (mc_dev);dprtc_close (mc_dev->mc_io,0 , mc_dev->mc_handle);fsl_mc_portal_free (mc_dev->mc_io); +of_node_put (dev->of_node); + dev->of_node =NULL ; }static const struct fsl_mc_device_id dpaa2_ptp_match_id_table[] = {
Signature · 1 line
2.43.0
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 16 Sep 2026 11:00:15 +0800 you wrote:
dpaa2_ptp_probe()gets a referenced device node withof_find_compatible_node()and stores it indev->of_node.The probe failure paths release this reference with
of_node_put(). However, after a successful probe,dpaa2_ptp_remove()tears down the PTP and MC resources without dropping the device node reference.[...]
Here is the summary with links:
- net: dpaa2: ptp: fix device node reference leak on remove
https://git.kernel.org/netdev/net-next/c/9211c455dee8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html