* [PATCH] phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe
@ 2025-10-28 6:25 Miaoqian Lin
2025-10-28 10:17 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2025-10-28 6:25 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Johan Hovold, Neil Armstrong,
Greg Kroah-Hartman, Roger Quadros, linux-phy, linux-kernel
Cc: linmq006, stable
In omap_usb2_probe(), of_parse_phandle() returns a device node with its
reference count incremented. The caller is responsible for releasing this
reference when the node is no longer needed.
Add of_node_put(control_node) after usage to fix the
reference leak.
Found via static analysis.
Fixes: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/phy/ti/phy-omap-usb2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/phy/ti/phy-omap-usb2.c b/drivers/phy/ti/phy-omap-usb2.c
index 1eb252604441..660df3181e4f 100644
--- a/drivers/phy/ti/phy-omap-usb2.c
+++ b/drivers/phy/ti/phy-omap-usb2.c
@@ -426,6 +426,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
}
control_pdev = of_find_device_by_node(control_node);
+ of_node_put(control_node);
if (!control_pdev) {
dev_err(&pdev->dev, "Failed to get control device\n");
return -EINVAL;
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe
2025-10-28 6:25 [PATCH] phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe Miaoqian Lin
@ 2025-10-28 10:17 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2025-10-28 10:17 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Vinod Koul, Kishon Vijay Abraham I, Neil Armstrong,
Greg Kroah-Hartman, Roger Quadros, linux-phy, linux-kernel,
stable
On Tue, Oct 28, 2025 at 02:25:06PM +0800, Miaoqian Lin wrote:
> In omap_usb2_probe(), of_parse_phandle() returns a device node with its
> reference count incremented. The caller is responsible for releasing this
> reference when the node is no longer needed.
>
> Add of_node_put(control_node) after usage to fix the
> reference leak.
>
> Found via static analysis.
>
> Fixes: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()")
> Cc: stable@vger.kernel.org
There should not be any need to backport this one.
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Other than that, looks good:
Reviewed-by: Johan Hovold <johan@kernel.org>
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-28 10:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 6:25 [PATCH] phy: ti: omap-usb2: Fix device node reference leak in omap_usb2_probe Miaoqian Lin
2025-10-28 10:17 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox