All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: fix potential double-free in m66592_probe.
@ 2020-05-23  4:06 wu000273
  0 siblings, 0 replies; only message in thread
From: wu000273 @ 2020-05-23  4:06 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, clabbe, linux-usb, linux-kernel, kjlu, wu000273

From: Qiushi Wu <wu000273@umn.edu>

m66592_free_request() is called under label "err_add_udc"
and "clean_up", and m66592->ep0_req is not set to NULL after
first free, leading to a double-free. Fix this issue by
setting m66592->ep0_req to NULL after the first free.

Fixes: 0f91349b89f3 ("usb: gadget: convert all users to the new udc infrastructure")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
---
 drivers/usb/gadget/udc/m66592-udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
index 75d16a8902e6..931e6362a13d 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1667,7 +1667,7 @@ static int m66592_probe(struct platform_device *pdev)
 
 err_add_udc:
 	m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
-
+	m66592->ep0_req = NULL;
 clean_up3:
 	if (m66592->pdata->on_chip) {
 		clk_disable(m66592->clk);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-23  4:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23  4:06 [PATCH] usb: gadget: fix potential double-free in m66592_probe wu000273

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.