summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2014-08-21 16:54:45 +0200
committerFelipe Balbi <balbi@ti.com>2014-08-21 10:03:41 -0500
commite73798572e115f73066567f5840d4e5c21da70a8 (patch)
tree05ac8625b4c58428f8c7af4e4c6a3cdbaeaea75b /drivers/usb
parentee7ec7f6b39d2ae25dca000398929edaa2ce412d (diff)
downloadop-kernel-dev-e73798572e115f73066567f5840d4e5c21da70a8.zip
op-kernel-dev-e73798572e115f73066567f5840d4e5c21da70a8.tar.gz
usb: gadget: f_uvc: fix potential memory leak
If uvc->control_buf is successfuly allocated but uvc->control_req is not, uvc->control_buf is not freed in the error recovery path. With this patch applied uvc->control_buf is freed unconditionally; if it happens to be NULL kfree on it is safe anyway. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_uvc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index e2a1f50..ff4340a 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -720,10 +720,9 @@ error:
if (uvc->video.ep)
uvc->video.ep->driver_data = NULL;
- if (uvc->control_req) {
+ if (uvc->control_req)
usb_ep_free_request(cdev->gadget->ep0, uvc->control_req);
- kfree(uvc->control_buf);
- }
+ kfree(uvc->control_buf);
usb_free_all_descriptors(f);
return ret;
OpenPOWER on IntegriCloud