]> git.baikalelectronics.ru Git - kernel.git/commit
[media] uvcvideo: Fix open/close race condition
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 26 Apr 2013 01:28:51 +0000 (22:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 8 Jun 2013 22:51:16 +0000 (19:51 -0300)
commitc7608ddc847312447fa77450db9e96e1bde68be0
tree110fbcca442fc9801187db3b73de32897fe9b9a0
parent7ad467cdb63be1a992e4e3cd202b452e49b166c8
[media] uvcvideo: Fix open/close race condition

Maintaining the users count using an atomic variable makes sure that
access to the counter won't be racy, but doesn't serialize access to the
operations protected by the counter. This creates a race condition that
could result in the status URB being submitted multiple times.
Use a mutex to protect the users count and serialize access to the
status start and stop operations.

Reported-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvc_status.c
drivers/media/usb/uvc/uvc_v4l2.c
drivers/media/usb/uvc/uvcvideo.h