]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
uvcvideo: Prevent new URBs being processed at stream stop
authorKieran Bingham <kieran.bingham@ideasonboard.com>
Wed, 7 Mar 2018 21:13:29 +0000 (13:13 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 16 Mar 2018 07:27:55 +0000 (08:27 +0100)
commitadef27d93071af2ca51ece26d25fae67d731b71b
tree16da1c47cca8c931d9ea146a4377dab2caa11d25
parent7a19629667405ac8a6701796fe2a21bd9bf34303
uvcvideo: Prevent new URBs being processed at stream stop

With asynchronous handling of the URBs from the USB Complete handler, we
get a continual stream of packets being received while we are attempting
to shutdown the stream.

Packets that have already been received and processed are on a
work-queue, but during stream shutdown the URBs that those packets
belong to are killed and free'd.

To prevent this race from causing invalid memory accesses, prevent new
URBs from being processed when uvc_stop_streaming() is called by
introducing a new flag "UVC_QUEUE_STOPPING" into the queue, and checking
this when processing the URB to be queued.

With this, we can flush the work queue, and commence a normal pipe
shutdown. Work tasks that are already queued are processed, but the URBs
are prevented from being re-submitted to the USB stack.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Christian Kohn <christian.kohn@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/media/usb/uvc/uvc_queue.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h