* [PATCH] usb: dwc3: fix possible object reference leak
@ 2023-10-05 13:49 Zhang Shurong
2023-10-05 13:59 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shurong @ 2023-10-05 13:49 UTC (permalink / raw)
To: Thinh.Nguyen
Cc: gregkh, shawnguo, s.hauer, kernel, festevam, linux-imx, linux-usb,
linux-arm-kernel, linux-kernel, Zhang Shurong
The of_find_device_by_node takes a reference to the struct device
when find the match device,we should release it when fail.
Fix it by calling by calling platform_device_put when error returns.
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
drivers/usb/dwc3/dwc3-imx8mp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
index a1e15f2fffdb..af5302c3f7a9 100644
--- a/drivers/usb/dwc3/dwc3-imx8mp.c
+++ b/drivers/usb/dwc3/dwc3-imx8mp.c
@@ -244,7 +244,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
IRQF_ONESHOT, dev_name(dev), dwc3_imx);
if (err) {
dev_err(dev, "failed to request IRQ #%d --> %d\n", irq, err);
- goto depopulate;
+ goto err_device_put;
}
device_set_wakeup_capable(dev, true);
@@ -252,6 +252,8 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
return 0;
+err_device_put:
+ platform_device_put(dwc3_imx->dwc3);
depopulate:
of_platform_depopulate(dev);
err_node_put:
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb: dwc3: fix possible object reference leak
2023-10-05 13:49 [PATCH] usb: dwc3: fix possible object reference leak Zhang Shurong
@ 2023-10-05 13:59 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-10-05 13:59 UTC (permalink / raw)
To: Zhang Shurong
Cc: Thinh.Nguyen, shawnguo, s.hauer, kernel, festevam, linux-imx,
linux-usb, linux-arm-kernel, linux-kernel
On Thu, Oct 05, 2023 at 09:49:46PM +0800, Zhang Shurong wrote:
> The of_find_device_by_node takes a reference to the struct device
> when find the match device,we should release it when fail.
>
> Fix it by calling by calling platform_device_put when error returns.
>
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> ---
What commit id does this fix?
And how did you find this? How was it tested?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-05 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-05 13:49 [PATCH] usb: dwc3: fix possible object reference leak Zhang Shurong
2023-10-05 13:59 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox