* [PATCH] usb: musb: omap2430: Do not put borrowed of_node in probe
@ 2026-07-05 9:14 Guangshuo Li
2026-07-06 7:07 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-07-05 9:14 UTC (permalink / raw)
To: Bin Liu, Greg Kroah-Hartman, Wentao Liang, linux-usb, linux-omap,
linux-kernel
Cc: Guangshuo Li
omap2430_probe() stores pdev->dev.of_node in a local np variable. This is
a borrowed pointer and the probe function does not take a reference to
it.
The success and error paths nevertheless call of_node_put(np). This drops
a reference that is owned by the platform device, and can leave
pdev->dev.of_node with an unbalanced reference count.
Do not put the borrowed platform device node from omap2430_probe().
References taken for the child MUSB device are handled by the device core,
and the ctrl-module phandle reference is still released separately.
Fixes: e194ce048f5a ("usb: musb: omap2430: Fix use-after-free in omap2430_probe()")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/usb/musb/omap2430.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 333ab79f0ca9..6e749faac33c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -454,7 +454,6 @@ static int omap2430_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to register musb device\n");
goto err_disable_rpm;
}
- of_node_put(np);
return 0;
@@ -464,7 +463,6 @@ static int omap2430_probe(struct platform_device *pdev)
if (!IS_ERR(glue->control_otghs))
put_device(glue->control_otghs);
err_put_musb:
- of_node_put(np);
platform_device_put(musb);
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb: musb: omap2430: Do not put borrowed of_node in probe
2026-07-05 9:14 [PATCH] usb: musb: omap2430: Do not put borrowed of_node in probe Guangshuo Li
@ 2026-07-06 7:07 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2026-07-06 7:07 UTC (permalink / raw)
To: Guangshuo Li
Cc: Bin Liu, Greg Kroah-Hartman, Wentao Liang, linux-usb, linux-omap,
linux-kernel
On Sun, Jul 05, 2026 at 05:14:11PM +0800, Guangshuo Li wrote:
> omap2430_probe() stores pdev->dev.of_node in a local np variable. This is
> a borrowed pointer and the probe function does not take a reference to
> it.
>
> The success and error paths nevertheless call of_node_put(np). This drops
> a reference that is owned by the platform device, and can leave
> pdev->dev.of_node with an unbalanced reference count.
>
> Do not put the borrowed platform device node from omap2430_probe().
> References taken for the child MUSB device are handled by the device core,
> and the ctrl-module phandle reference is still released separately.
>
> Fixes: e194ce048f5a ("usb: musb: omap2430: Fix use-after-free in omap2430_probe()")
This was not the commit that introduced the issue. This should be:
Fixes: ffbe2feac59b ("usb: musb: omap2430: Fix probe regression for missing resources")
and this should be backported to stable as well:
Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
And again, how are you finding these issues? Still no LLM involved?
With the above fixed:
Reviewed-by: Johan Hovold <johan@kernel.org>
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-06 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 9:14 [PATCH] usb: musb: omap2430: Do not put borrowed of_node in probe Guangshuo Li
2026-07-06 7:07 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox