diff mbox series

[v2] usb: gadget: function: printer: Fix a memory leak for interface descriptor

Message ID 20201210020148.6691-1-qiang.zhang@windriver.com (mailing list archive)
State Accepted
Commit 2cc332e4ee4febcbb685e2962ad323fe4b3b750a
Headers show
Series [v2] usb: gadget: function: printer: Fix a memory leak for interface descriptor | expand

Commit Message

Zhang, Qiang Dec. 10, 2020, 2:01 a.m. UTC
From: Zqiang <qiang.zhang@windriver.com>

When printer driver is loaded, the printer_func_bind function is called, in
this function, the interface descriptor be allocated memory, if after that,
the error occurred, the interface descriptor memory need to be free.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---

 v1->v2:
 Modify description information and add tags.

 drivers/usb/gadget/function/f_printer.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
index 64a4112068fc..2f1eb2e81d30 100644
--- a/drivers/usb/gadget/function/f_printer.c
+++ b/drivers/usb/gadget/function/f_printer.c
@@ -1162,6 +1162,7 @@  static int printer_func_bind(struct usb_configuration *c,
 		printer_req_free(dev->in_ep, req);
 	}
 
+	usb_free_all_descriptors(f);
 	return ret;
 
 }