* [PATCH] usb: gadget: r8a66597: avoid double free of ep0_req in probe error path
@ 2026-06-24 14:09 Hongyan Xu
0 siblings, 0 replies; only message in thread
From: Hongyan Xu @ 2026-06-24 14:09 UTC (permalink / raw)
To: gregkh; +Cc: linux-usb, getshell, jianhao.xu, Slavin Liu
If usb_add_gadget_udc() fails, r8a66597_probe() jumps to err_add_udc
and frees ep0_req, then falls through to clean_up2 where ep0_req is
freed again when it is non-NULL.
Remove the redundant free from err_add_udc and keep the cleanup in
clean_up2 so the request is released exactly once.
Fixes: 776976a67ae2 ("usb: gadget: r8a66597-udc: cleanup error path")
Issue found using a prototype static analysis tool
and confirmed by code review.
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
Signed-off-by: Slavin Liu <220245772@seu.edu.cn>
---
drivers/usb/gadget/udc/r8a66597-udc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
index e7a5d8553c0e..d190e16d43fc 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1951,7 +1951,6 @@ static int r8a66597_probe(struct platform_device *pdev)
return 0;
err_add_udc:
- r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
clean_up2:
if (r8a66597->pdata->on_chip)
clk_disable_unprepare(r8a66597->clk);
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-24 14:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24 14:09 [PATCH] usb: gadget: r8a66597: avoid double free of ep0_req in probe error path Hongyan Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox