======================================================
WARNING: possible circular locking dependency detected
5.18.0-rc1-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/25736 is trying to acquire lock:
ffffffff88670108 (driver_lock){+.+.}-{3:3}, at: display_open+0x1f/0x220 drivers/media/rc/imon.c:503

but task is already holding lock:
ffffffff883fa450 (minor_rwsem){++++}-{3:3}
, at: usb_open+0x24/0x2e0 drivers/usb/core/file.c:39

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (minor_rwsem){++++}-{3:3}
:
       down_write+0x90/0x150 kernel/locking/rwsem.c:1514
       usb_deregister_dev+0xaa/0x320 drivers/usb/core/file.c:239
       imon_disconnect+0x62a/0x770 drivers/media/rc/imon.c:2531
       usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458
       device_remove drivers/base/dd.c:531 [inline]
       device_remove+0x11f/0x170 drivers/base/dd.c:523
       __device_release_driver drivers/base/dd.c:1199 [inline]
       device_release_driver_internal+0x4a3/0x680 drivers/base/dd.c:1222
       bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529
       device_del+0x4f3/0xc80 drivers/base/core.c:3592
       usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419
       usb_disconnect.cold+0x278/0x6ec drivers/usb/core/hub.c:2228
       hub_port_connect drivers/usb/core/hub.c:5207 [inline]
       hub_port_connect_change drivers/usb/core/hub.c:5507 [inline]
       port_event drivers/usb/core/hub.c:5665 [inline]
       hub_event+0x1e74/0x4680 drivers/usb/core/hub.c:5747
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2ef/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

-> #0 (driver_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3065 [inline]
       check_prevs_add kernel/locking/lockdep.c:3188 [inline]
       validate_chain kernel/locking/lockdep.c:3803 [inline]
       __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5029
       lock_acquire kernel/locking/lockdep.c:5641 [inline]
       lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5606
       __mutex_lock_common kernel/locking/mutex.c:600 [inline]
       __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733
       display_open+0x1f/0x220 drivers/media/rc/imon.c:503
       usb_open+0x204/0x2e0 drivers/usb/core/file.c:48
       chrdev_open+0x266/0x770 fs/char_dev.c:414
       do_dentry_open+0x49c/0x10a0 fs/open.c:824
       do_open fs/namei.c:3476 [inline]
       path_openat+0x1c71/0x2910 fs/namei.c:3609
       do_filp_open+0x1aa/0x400 fs/namei.c:3636
       do_sys_openat2+0x16d/0x4c0 fs/open.c:1213
       do_sys_open fs/open.c:1229 [inline]
       __do_sys_openat fs/open.c:1245 [inline]
       __se_sys_openat fs/open.c:1240 [inline]
       __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(minor_rwsem);
                               lock(driver_lock);
                               lock(minor_rwsem);
  lock(driver_lock);

 *** DEADLOCK ***

1 lock held by syz-executor.3/25736:
 #0: ffffffff883fa450 (minor_rwsem){++++}-{3:3}, at: usb_open+0x24/0x2e0 drivers/usb/core/file.c:39

stack backtrace:
CPU: 1 PID: 25736 Comm: syz-executor.3 Not tainted 5.18.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2145
 check_prev_add kernel/locking/lockdep.c:3065 [inline]
 check_prevs_add kernel/locking/lockdep.c:3188 [inline]
 validate_chain kernel/locking/lockdep.c:3803 [inline]
 __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5029
 lock_acquire kernel/locking/lockdep.c:5641 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5606
 __mutex_lock_common kernel/locking/mutex.c:600 [inline]
 __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733
 display_open+0x1f/0x220 drivers/media/rc/imon.c:503
 usb_open+0x204/0x2e0 drivers/usb/core/file.c:48
 chrdev_open+0x266/0x770 fs/char_dev.c:414
 do_dentry_open+0x49c/0x10a0 fs/open.c:824
 do_open fs/namei.c:3476 [inline]
 path_openat+0x1c71/0x2910 fs/namei.c:3609
 do_filp_open+0x1aa/0x400 fs/namei.c:3636
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1213
 do_sys_open fs/open.c:1229 [inline]
 __do_sys_openat fs/open.c:1245 [inline]
 __se_sys_openat fs/open.c:1240 [inline]
 __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f898514bf64
Code: 84 00 00 00 00 00 44 89 54 24 0c e8 96 f9 ff ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 89 44 24 0c e8 c8 f9 ff ff 8b 44
RSP: 002b:00007f89848edca0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f89852ac030 RCX: 00007f898514bf64
RDX: 0000000000000002 RSI: 00007f89848edd40 RDI: 00000000ffffff9c
RBP: 00007f89848edd40 R08: 0000000000000000 R09: 000000000000000f
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002
R13: 00007ffc915eb35f R14: 00007f89848ee300 R15: 0000000000022000
 </TASK>