Re: [PATCH v2 1/3] usb: gadget/uvc: fix possible lockup in uvc gadget

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

Thank you for the patch.

On Friday 08 August 2014 17:38:57 Michael Grzeschik wrote:
> 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.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> ---
> v1 -> v2:
>  - moved uvc_queue_cancel outside the spinlock
> 
>  drivers/usb/gadget/uvc_video.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/gadget/uvc_video.c b/drivers/usb/gadget/uvc_video.c
> index 71e896d..a5eb9a3 100644
> --- a/drivers/usb/gadget/uvc_video.c
> +++ b/drivers/usb/gadget/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);

Just nitpicking here, you could call

			uvc_queue_cancel(&video->queue, 0);

without adding a new local variable, given that video->queue is already used 
in several places in this function.

>  			break;
>  		}
>  		spin_unlock_irqrestore(&video->queue.irqlock, flags);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux