em28xx-video: Swap release order to avoid lock nesting
Subsystems (2)
PATCH 1/1 em28xx-video: Swap release order to avoid lock nesting
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 <[email protected]>
--- drivers/media/usb/em28xx/em28xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-video.c +1 -1
@@ -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,
Signature · 1 line
1.8.4.rc3
Quoted 15 lines · Ricardo Ribalda Delgado
vb2_fop_releasemight take the video queue mutex lock.
In order to avoid nesting mutexes the private mutex is taken after thefop_releasehas finished.Signed-off-by Ricardo Ribalda Delgado <[email protected]>--- drivers/media/usb/em28xx/em28xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/usb/em28xx/em28xx-video.c +0
-0
drivers/media/usb/em28xx/em28xx-video.c static int em28xx_v4l2_close(struct file *filp) · line 1670
Quoted 9 lines
drivers/media/usb/em28xx/em28xx-video.c +1
-1@@ -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 <[email protected]>
Regards,
Hans