Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 2 participants 2 messages Dec 9, 2020 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: function: printer: Fix a memory leak for interface descriptor

From: Zqiang <[email protected]>

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

---
 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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · On 20-12-09 11:00:18, [email protected] wrote:

From: Zqiang <[email protected]>

When printer driver be load, the printer_func_bind function be called, in

is loaded is called

Quoted 1 line

this function, the interface descriptor be allocated memory, if after that,

descriptors memory region are allocated

Quoted 1 line

the error occurred, the interface descriptor memory need to be free.

occurs,

Except Typo, otherwise:

Besides, it is bug-fix, you could add fixes tag, and cc [email protected].

Peter

Quoted 21 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);
 	return ret;
 
 }
Signature · 1 line
2.17.1
Signature · 2 lines
Thanks,
Peter Chen