diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/uvc/uvc_driver.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 4deb04bc2a73..f2b2983fe062 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -1633,13 +1633,16 @@ static void uvc_disconnect(struct usb_interface *intf) | |||
1633 | * reference to the uvc_device instance after uvc_v4l2_open() received | 1633 | * reference to the uvc_device instance after uvc_v4l2_open() received |
1634 | * the pointer to the device (video_devdata) but before it got the | 1634 | * the pointer to the device (video_devdata) but before it got the |
1635 | * chance to increase the reference count (kref_get). | 1635 | * chance to increase the reference count (kref_get). |
1636 | * | ||
1637 | * Note that the reference can't be released with the lock held, | ||
1638 | * otherwise a AB-BA deadlock can occur with videodev_lock that | ||
1639 | * videodev acquires in videodev_open() and video_unregister_device(). | ||
1636 | */ | 1640 | */ |
1637 | mutex_lock(&uvc_driver.open_mutex); | 1641 | mutex_lock(&uvc_driver.open_mutex); |
1638 | |||
1639 | dev->state |= UVC_DEV_DISCONNECTED; | 1642 | dev->state |= UVC_DEV_DISCONNECTED; |
1640 | kref_put(&dev->kref, uvc_delete); | ||
1641 | |||
1642 | mutex_unlock(&uvc_driver.open_mutex); | 1643 | mutex_unlock(&uvc_driver.open_mutex); |
1644 | |||
1645 | kref_put(&dev->kref, uvc_delete); | ||
1643 | } | 1646 | } |
1644 | 1647 | ||
1645 | static int uvc_suspend(struct usb_interface *intf, pm_message_t message) | 1648 | static int uvc_suspend(struct usb_interface *intf, pm_message_t message) |