提交 e7379857 编写于 作者: A Andrzej Pietrasiewicz 提交者: Felipe Balbi

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: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 ee7ec7f6
......@@ -720,10 +720,9 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册