Skip to contentSkip to conversation

usb: gadget: function: printer: Fix usb function descriptors leak

PATCH In review Zqiang 2 participants 2 messages Oct 14, 2020 USB

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 usb: gadget: function: printer: Fix usb function descriptors leak

If an error occurs after call 'usb_assign_descriptors' func, the 'usb_free_all_descriptors' need to be call to release memory space occupied by function descriptors.

---
 drivers/usb/gadget/function/f_printer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_printer.c +1 -0
index 64a4112068fc..2f1eb2e81d30 100644
@@ -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;
 
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 5 lines · Zqiang

If an error occurs after call 'usb_assign_descriptors' func, the 'usb_free_all_descriptors' need to be call to release memory space occupied by function descriptors.

Please use your ful name for the From: and signed-off-by lines, as the documentation states is required. If this is your full name, then why does it not match the name on your email address from your employer?

drivers/usb/gadget/function/f_printer.c static int printer_func_bind(struct usb_configuration *c, · line 1165

Quoted 13 lines
---
 drivers/usb/gadget/function/f_printer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_printer.c +1 -0
index 64a4112068fc..2f1eb2e81d30 100644
@@ -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);

What commit caused this problem?

thanks,

greg k-h