aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2013-01-10 07:04:55 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-05 14:32:21 -0200
commita82a45f65377b05fe8cd3167c7b0a70c508356b8 (patch)
tree6b40a93218a8abef192e346c4052875f07c58a07 /drivers/media/usb
parent[media] uvcvideo: Replace memcpy with struct assignment (diff)
downloadlinux-dev-a82a45f65377b05fe8cd3167c7b0a70c508356b8.tar.xz
linux-dev-a82a45f65377b05fe8cd3167c7b0a70c508356b8.zip
[media] uvcvideo: Fix race of open and suspend in error case
Ming Lei reported: IMO, there is a minor fault in the error handling path of uvc_status_start() inside uvc_v4l2_open(), and the 'users' count should have been decreased before usb_autopm_put_interface(). In theory, a [URB resubmission] warning can be triggered when the device is opened just between usb_autopm_put_interface() and atomic_dec(&stream->dev->users). The fix is trivial. Reported-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 97a4ffde5d6f..b2dc32623a71 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -501,8 +501,8 @@ static int uvc_v4l2_open(struct file *file)
if (atomic_inc_return(&stream->dev->users) == 1) {
ret = uvc_status_start(stream->dev);
if (ret < 0) {
- usb_autopm_put_interface(stream->dev->intf);
atomic_dec(&stream->dev->users);
+ usb_autopm_put_interface(stream->dev->intf);
kfree(handle);
return ret;
}