Re: [syzbot] [media?] [usb?] INFO: task hung in vb2_video_unregister_device

From: Lizhi Xu
Date: Thu Feb 29 2024 - 02:20:38 EST


#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index c575198e8354..437f80551a2d 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -1262,8 +1262,7 @@ void vb2_video_unregister_device(struct video_device *vdev)
get_device(&vdev->dev);
video_unregister_device(vdev);
if (vdev->queue) {
- struct mutex *lock = vdev->queue->lock ?
- vdev->queue->lock : vdev->lock;
+ struct mutex *lock = vdev->queue->lock;

if (lock)
mutex_lock(lock);