Re: [syzbot] [usb?] [media?] possible deadlock in vb2_video_unregister_device
From: Hillf Danton
Date: Wed Feb 07 2024 - 06:09:00 EST
On Wed, 07 Feb 2024 00:44:22 -0800
> HEAD commit: ed5551279c91 Merge 6.8-rc3 into usb-next
> git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1603629fe80000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
--- x/drivers/media/usb/usbtv/usbtv-video.c
+++ y/drivers/media/usb/usbtv/usbtv-video.c
@@ -963,11 +963,11 @@ ctrl_fail:
void usbtv_video_free(struct usbtv *usbtv)
{
+ usbtv_stop(usbtv);
+ vb2_video_unregister_device(&usbtv->vdev);
mutex_lock(&usbtv->vb2q_lock);
mutex_lock(&usbtv->v4l2_lock);
- usbtv_stop(usbtv);
- vb2_video_unregister_device(&usbtv->vdev);
v4l2_device_disconnect(&usbtv->v4l2_dev);
mutex_unlock(&usbtv->v4l2_lock);
--