mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: dpaa2: ptp: fix device node reference leak on remove
@ 2026-09-16  3:00 Guangshuo Li
  2026-09-19  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-09-16  3:00 UTC (permalink / raw)
  To: Yangbo Lu, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, netdev,
	linux-kernel
  Cc: Guangshuo Li, stable

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.

Fixes: d346c9e86d86 ("dpaa2-ptp: reuse ptp_qoriq driver")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
index 4497e3c0456d..440319a1e775 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
@@ -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[] = {
-- 
2.43.0


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

* Re: [PATCH] net: dpaa2: ptp: fix device node reference leak on remove
  2026-09-16  3:00 [PATCH] net: dpaa2: ptp: fix device node reference leak on remove Guangshuo Li
@ 2026-09-19  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-19  0:10 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: yangbo.lu, andrew+netdev, davem, edumazet, kuba, pabeni,
	richardcochran, netdev, linux-kernel, stable

Hello:

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

On Wed, 16 Sep 2026 11:00:15 +0800 you wrote:
> 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-09-19  0:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  3:00 [PATCH] net: dpaa2: ptp: fix device node reference leak on remove Guangshuo Li
2026-09-19  0:10 ` patchwork-bot+netdevbpf

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®