syzbot


possible deadlock in __input_unregister_device

Status: upstream: reported on 2025/03/06 09:26
Reported-by: syzbot+3d32d7cd40dacc2cbf84@syzkaller.appspotmail.com
First crash: 45d, last: 45d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in __input_unregister_device 1 46d 46d 0/3 upstream: reported on 2025/03/06 06:51
upstream possible deadlock in __input_unregister_device input 289 63d 252d 0/28 upstream: reported on 2024/08/11 15:16

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.129-syzkaller #0 Not tainted
------------------------------------------------------
syz.2.1408/9232 is trying to acquire lock:
ffff8880267c22c0 (&dev->mutex#2){+.+.}-{3:3}, at: input_disconnect_device drivers/input/input.c:757 [inline]
ffff8880267c22c0 (&dev->mutex#2){+.+.}-{3:3}, at: __input_unregister_device+0x31/0x630 drivers/input/input.c:2291

but task is already holding lock:
ffff888075a81e18 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2338

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&hdev->ll_open_lock){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2338
       input_open_device+0x188/0x2d0 drivers/input/input.c:650
       mousedev_open_device+0xc3/0x160 drivers/input/mousedev.c:430
       mousedev_open+0x2c9/0x470 drivers/input/mousedev.c:556
       chrdev_open+0x54a/0x630 fs/char_dev.c:414
       do_dentry_open+0x7f9/0x10f0 fs/open.c:882
       do_open fs/namei.c:3626 [inline]
       path_openat+0x2644/0x2e60 fs/namei.c:3783
       do_filp_open+0x230/0x480 fs/namei.c:3810
       do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1345
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&dev->mutex#2){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       input_disconnect_device drivers/input/input.c:757 [inline]
       __input_unregister_device+0x31/0x630 drivers/input/input.c:2291
       input_unregister_device+0x9f/0xf0 drivers/input/input.c:2514
       steam_client_ll_open+0x73/0x90 drivers/hid/hid-steam.c:640
       hid_hw_open+0xdb/0x160 drivers/hid/hid-core.c:2343
       hidraw_open+0x291/0x8d0 drivers/hid/hidraw.c:294
       chrdev_open+0x54a/0x630 fs/char_dev.c:414
       do_dentry_open+0x7f9/0x10f0 fs/open.c:882
       do_open fs/namei.c:3626 [inline]
       path_openat+0x2644/0x2e60 fs/namei.c:3783
       do_filp_open+0x230/0x480 fs/namei.c:3810
       do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1345
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&hdev->ll_open_lock);
                               lock(&dev->mutex#2);
                               lock(&hdev->ll_open_lock);
  lock(&dev->mutex#2);

 *** DEADLOCK ***

2 locks held by syz.2.1408/9232:
 #0: ffffffff8e3bccd0 (minors_rwsem){++++}-{3:3}, at: hidraw_open+0x8f/0x8d0 drivers/hid/hidraw.c:280
 #1: ffff888075a81e18 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2338

stack backtrace:
CPU: 1 PID: 9232 Comm: syz.2.1408 Not tainted 6.1.129-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 input_disconnect_device drivers/input/input.c:757 [inline]
 __input_unregister_device+0x31/0x630 drivers/input/input.c:2291
 input_unregister_device+0x9f/0xf0 drivers/input/input.c:2514
 steam_client_ll_open+0x73/0x90 drivers/hid/hid-steam.c:640
 hid_hw_open+0xdb/0x160 drivers/hid/hid-core.c:2343
 hidraw_open+0x291/0x8d0 drivers/hid/hidraw.c:294
 chrdev_open+0x54a/0x630 fs/char_dev.c:414
 do_dentry_open+0x7f9/0x10f0 fs/open.c:882
 do_open fs/namei.c:3626 [inline]
 path_openat+0x2644/0x2e60 fs/namei.c:3783
 do_filp_open+0x230/0x480 fs/namei.c:3810
 do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f3308f8bad0
Code: 48 89 44 24 20 75 93 44 89 54 24 0c e8 49 94 02 00 44 8b 54 24 0c 89 da 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 38 44 89 c7 89 44 24 0c e8 9c 94 02 00 8b 44
RSP: 002b:00007f3309e4eb70 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3308f8bad0
RDX: 0000000000000000 RSI: 00007f3309e4ec10 RDI: 00000000ffffff9c
RBP: 00007f3309e4ec10 R08: 0000000000000000 R09: 0023776172646968
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f33091a5fa0 R15: 00007ffd7774e4d8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/06 09:25 linux-6.1.y 3a8358583626 831e3629 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in __input_unregister_device
* Struck through repros no longer work on HEAD.