summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorZqiang <qiang.zhang@windriver.com>2020-12-10 05:01:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-28 17:45:16 +0300
commit2cc332e4ee4febcbb685e2962ad323fe4b3b750a (patch)
tree89bacf663ff7fcaff1853b7260e06710bc27078d /drivers/usb/gadget
parenta5ada3dfe6a20f41f91448b9034a1ef8da3dc87d (diff)
downloadlinux-2cc332e4ee4febcbb685e2962ad323fe4b3b750a.tar.xz
usb: gadget: function: printer: Fix a memory leak for interface descriptor
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> Link: https://lore.kernel.org/r/20201210020148.6691-1-qiang.zhang@windriver.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/function/f_printer.c1
1 files changed, 1 insertions, 0 deletions
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 @@ fail_tx_reqs:
printer_req_free(dev->in_ep, req);
}
+ usb_free_all_descriptors(f);
return ret;
}