From: Michael Grzeschik Date: Fri, 8 Aug 2014 15:38:57 +0000 (+0200) Subject: usb: gadget: uvc: fix possible lockup in uvc gadget X-Git-Tag: v4.14-rc1~6932^2~15^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd52b813a999e44d2e35c2390d02fa4d0f61d08a;p=platform%2Fkernel%2Flinux-rpi.git usb: gadget: uvc: fix possible lockup in uvc gadget If the pending buffers in the queue could not be pushed to the udc endpoint we have to cancel the uvc_queue. Otherwise the gadget will get stuck on this error. This patch calls uvc_queue_cancel if usb_ep_queue failed. Acked-by: Laurent Pinchart Signed-off-by: Michael Grzeschik Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index 71e896d..a5eb9a3 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -195,6 +195,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) printk(KERN_INFO "Failed to queue request (%d).\n", ret); usb_ep_set_halt(ep); spin_unlock_irqrestore(&video->queue.irqlock, flags); + uvc_queue_cancel(queue, 0); goto requeue; } spin_unlock_irqrestore(&video->queue.irqlock, flags); @@ -281,6 +282,7 @@ error: static int uvc_video_pump(struct uvc_video *video) { + struct uvc_video_queue *queue = &video->queue; struct usb_request *req; struct uvc_buffer *buf; unsigned long flags; @@ -322,6 +324,7 @@ uvc_video_pump(struct uvc_video *video) printk(KERN_INFO "Failed to queue request (%d)\n", ret); usb_ep_set_halt(video->ep); spin_unlock_irqrestore(&video->queue.irqlock, flags); + uvc_queue_cancel(queue, 0); break; } spin_unlock_irqrestore(&video->queue.irqlock, flags);