Re: [PATCH] usb: musb: omap2430: Do not put borrowed of_node in probe

Johan Hovold <[email protected]> Mon, 6 Jul 2026 09:07:17 +0200
Newsgroups org.kernel.vger.linux-omap,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb
Message-ID <[email protected]>
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: [email protected]

> Signed-off-by: Guangshuo Li <[email protected]>

And again, how are you finding these issues? Still no LLM involved?

With the above fixed:

Reviewed-by: Johan Hovold <[email protected]>

Johan