em28xx-video: Swap release order to avoid lock nesting
Commit Message
vb2_fop_release might take the video queue mutex lock.
In order to avoid nesting mutexes the private mutex is taken after the
fop_release has finished.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/usb/em28xx/em28xx-video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/06/13 09:39, Ricardo Ribalda Delgado wrote:
> vb2_fop_release might take the video queue mutex lock.
> In order to avoid nesting mutexes the private mutex is taken after the
> fop_release has finished.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> drivers/media/usb/em28xx/em28xx-video.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
> index 9d10334..b5c3360 100644
> --- a/drivers/media/usb/em28xx/em28xx-video.c
> +++ b/drivers/media/usb/em28xx/em28xx-video.c
> @@ -1663,8 +1663,8 @@ static int em28xx_v4l2_close(struct file *filp)
>
> em28xx_videodbg("users=%d\n", dev->users);
>
> - mutex_lock(&dev->lock);
> vb2_fop_release(filp);
> + mutex_lock(&dev->lock);
>
> if (dev->users == 1) {
> /* the device is already disconnect,
>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -1663,8 +1663,8 @@ static int em28xx_v4l2_close(struct file *filp)
em28xx_videodbg("users=%d\n", dev->users);
- mutex_lock(&dev->lock);
vb2_fop_release(filp);
+ mutex_lock(&dev->lock);
if (dev->users == 1) {
/* the device is already disconnect,