syzbot


possible deadlock in usb_reset_and_verify_device

Status: auto-closed as invalid on 2022/01/03 05:12
Reported-by: syzbot+7f3f8da319285fc76bcb@syzkaller.appspotmail.com
First crash: 383d, last: 377d

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.16.0-rc2-next-20211123-syzkaller #0 Not tainted
------------------------------------------------------
usb-storage/9473 is trying to acquire lock:
ffff888147886668 (hcd->address0_mutex){+.+.}-{3:3}, at: usb_reset_and_verify_device+0x3ee/0xee0 drivers/usb/core/hub.c:5923

but task is already holding lock:
ffff88801d2d75c0 (&port_dev->status_lock){+.+.}-{3:3}, at: usb_lock_port drivers/usb/core/hub.c:3086 [inline]
ffff88801d2d75c0 (&port_dev->status_lock){+.+.}-{3:3}, at: usb_reset_device+0x4b4/0x9a0 drivers/usb/core/hub.c:6107

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&port_dev->status_lock){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:607 [inline]
       __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740
       usb_lock_port drivers/usb/core/hub.c:3086 [inline]
       hub_port_connect drivers/usb/core/hub.c:5279 [inline]
       hub_port_connect_change drivers/usb/core/hub.c:5493 [inline]
       port_event drivers/usb/core/hub.c:5639 [inline]
       hub_event+0x21c1/0x4450 drivers/usb/core/hub.c:5721
       process_one_work+0x9b2/0x1690 kernel/workqueue.c:2299
       worker_thread+0x658/0x11f0 kernel/workqueue.c:2446
       kthread+0x405/0x4f0 kernel/kthread.c:327
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 (hcd->address0_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3063 [inline]
       check_prevs_add kernel/locking/lockdep.c:3186 [inline]
       validate_chain kernel/locking/lockdep.c:3801 [inline]
       __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5027
       lock_acquire kernel/locking/lockdep.c:5637 [inline]
       lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602
       __mutex_lock_common kernel/locking/mutex.c:607 [inline]
       __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740
       usb_reset_and_verify_device+0x3ee/0xee0 drivers/usb/core/hub.c:5923
       usb_reset_device+0x4bd/0x9a0 drivers/usb/core/hub.c:6108
       usb_stor_port_reset drivers/usb/storage/transport.c:1443 [inline]
       usb_stor_port_reset+0x19a/0x1f0 drivers/usb/storage/transport.c:1425
       usb_stor_invoke_transport+0x6ac/0x16e0 drivers/usb/storage/transport.c:919
       usb_stor_control_thread+0x5e5/0xaa0 drivers/usb/storage/usb.c:380
       kthread+0x405/0x4f0 kernel/kthread.c:327
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&port_dev->status_lock);
                               lock(hcd->address0_mutex);
                               lock(&port_dev->status_lock);
  lock(hcd->address0_mutex);

 *** DEADLOCK ***

3 locks held by usb-storage/9473:
 #0: ffff88807d9c5220 (&dev->mutex){....}-{3:3}, at: device_trylock include/linux/device.h:770 [inline]
 #0: ffff88807d9c5220 (&dev->mutex){....}-{3:3}, at: usb_lock_device_for_reset+0x13e/0x2d0 drivers/usb/core/usb.c:872
 #1: ffff88803b454e48 (&us_interface_key[i]){+.+.}-{3:3}, at: usb_stor_pre_reset+0x35/0x40 drivers/usb/storage/usb.c:230
 #2: ffff88801d2d75c0 (&port_dev->status_lock){+.+.}-{3:3}, at: usb_lock_port drivers/usb/core/hub.c:3086 [inline]
 #2: ffff88801d2d75c0 (&port_dev->status_lock){+.+.}-{3:3}, at: usb_reset_device+0x4b4/0x9a0 drivers/usb/core/hub.c:6107

stack backtrace:
CPU: 1 PID: 9473 Comm: usb-storage Not tainted 5.16.0-rc2-next-20211123-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:2143
 check_prev_add kernel/locking/lockdep.c:3063 [inline]
 check_prevs_add kernel/locking/lockdep.c:3186 [inline]
 validate_chain kernel/locking/lockdep.c:3801 [inline]
 __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5027
 lock_acquire kernel/locking/lockdep.c:5637 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602
 __mutex_lock_common kernel/locking/mutex.c:607 [inline]
 __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740
 usb_reset_and_verify_device+0x3ee/0xee0 drivers/usb/core/hub.c:5923
 usb_reset_device+0x4bd/0x9a0 drivers/usb/core/hub.c:6108
 usb_stor_port_reset drivers/usb/storage/transport.c:1443 [inline]
 usb_stor_port_reset+0x19a/0x1f0 drivers/usb/storage/transport.c:1425
 usb_stor_invoke_transport+0x6ac/0x16e0 drivers/usb/storage/transport.c:919
 usb_stor_control_thread+0x5e5/0xaa0 drivers/usb/storage/usb.c:380
 kthread+0x405/0x4f0 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
usb 1-1: reset high-speed USB device number 2 using dummy_hcd
usb 1-1: Using ep0 maxpacket: 16
usb 1-1: reset high-speed USB device number 2 using dummy_hcd
usb 1-1: device descriptor read/64, error -32
usb 1-1: reset high-speed USB device number 2 using dummy_hcd
usb 1-1: device descriptor read/64, error -32
usb 1-1: reset high-speed USB device number 2 using dummy_hcd
usb 1-1: device descriptor read/8, error -71

Crashes (308):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-linux-next-kasan-gce-root 2021/11/24 04:42 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/24 03:01 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/24 01:12 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/24 00:09 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 23:55 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 20:51 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 19:01 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 16:59 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 15:46 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 14:17 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 08:54 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 07:37 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 06:24 linux-next aacdecce8147 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 05:20 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 04:41 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/23 02:18 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 21:51 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 19:58 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 18:28 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 16:22 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 15:07 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 14:25 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 13:14 linux-next 5191249f8803 545ab074 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 12:04 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 09:58 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 08:45 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 04:41 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/22 00:22 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 22:45 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 20:56 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 19:40 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 17:55 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 16:49 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 10:04 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 08:37 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 06:31 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/21 04:36 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 23:58 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 15:25 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 13:50 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 12:29 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 12:20 linux-next 5191249f8803 4eb20a4e .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 11:13 linux-next 5191249f8803 3a9d0024 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 10:06 linux-next 5191249f8803 3a9d0024 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 08:33 linux-next 5191249f8803 3a9d0024 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/20 07:21 linux-next 5191249f8803 3a9d0024 .config log report info possible deadlock in usb_reset_and_verify_device
ci-upstream-linux-next-kasan-gce-root 2021/11/18 05:10 linux-next 5191249f8803 cafff8b6 .config log report info possible deadlock in usb_reset_and_verify_device
* Struck through repros no longer work on HEAD.