[v6.1] possible deadlock in input_register_device (2)

0 views
Skip to first unread message

syzbot

unread,
9:59 AM (13 hours ago) 9:59 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 50cbba13faa2 Linux 6.1.159
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10cbe392580000
kernel config: https://syzkaller.appspot.com/x/.config?x=6a5cbd268406bf43
dashboard link: https://syzkaller.appspot.com/bug?extid=a561ba20fcbdd8624c05
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/50ceb00b1b39/disk-50cbba13.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ebb8883b9a29/vmlinux-50cbba13.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7edc2a795f03/bzImage-50cbba13.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a561ba...@syzkaller.appspotmail.com

input: Steam Controller as /devices/platform/dummy_hcd.1/usb2/2-1/2-1:0.0/0003:28DE:1102.0006/input/input14
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.5.371/6216 is trying to acquire lock:
ffffffff8d629028 (input_mutex){+.+.}-{3:3}, at: input_register_device+0xbc6/0x1310 drivers/input/input.c:2463

but task is already holding lock:
ffff888052a01e18 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_close+0x2c/0xd0 drivers/hid/hid-core.c:2378

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&hdev->ll_open_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x120/0xaf0 kernel/locking/mutex.c:747
hid_hw_open+0x23/0x160 drivers/hid/hid-core.c:2352
input_open_device+0x16c/0x2e0 drivers/input/input.c:650
evdev_open_device drivers/input/evdev.c:400 [inline]
evdev_open+0x4b0/0x5b0 drivers/input/evdev.c:487
chrdev_open+0x597/0x670 fs/char_dev.c:414
do_dentry_open+0x7e9/0x10d0 fs/open.c:882
do_open fs/namei.c:3634 [inline]
path_openat+0x25c6/0x2e70 fs/namei.c:3791
do_filp_open+0x1c1/0x3c0 fs/namei.c:3818
do_sys_openat2+0x142/0x490 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&dev->mutex#2){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x120/0xaf0 kernel/locking/mutex.c:747
input_register_handle+0x67/0x3a0 drivers/input/input.c:2629
kbd_connect+0xbf/0x130 drivers/tty/vt/keyboard.c:1589
input_attach_handler drivers/input/input.c:1060 [inline]
input_register_device+0xdfd/0x1310 drivers/input/input.c:2470
acpi_button_add+0x6b7/0xae0 drivers/acpi/button.c:570
acpi_device_probe+0xa3/0x300 drivers/acpi/bus.c:1023
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x2aa/0xc70 drivers/base/dd.c:639
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:785
driver_probe_device+0x4f/0x420 drivers/base/dd.c:815
__driver_attach+0x44a/0x6e0 drivers/base/dd.c:1201
bus_for_each_dev+0x175/0x1e0 drivers/base/bus.c:303
bus_add_driver+0x30a/0x5a0 drivers/base/bus.c:620
driver_register+0x32d/0x430 drivers/base/driver.c:246
do_one_initcall+0x214/0x7a0 init/main.c:1310
do_initcall_level+0x137/0x1e4 init/main.c:1383
do_initcalls+0x4b/0x8a init/main.c:1399
kernel_init_freeable+0x3fa/0x5ac init/main.c:1638
kernel_init+0x19/0x1b0 init/main.c:1526
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 (input_mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x120/0xaf0 kernel/locking/mutex.c:747
input_register_device+0xbc6/0x1310 drivers/input/input.c:2463
steam_input_register+0x9df/0xcb0 drivers/hid/hid-steam.c:469
hid_hw_close+0xa5/0xd0 drivers/hid/hid-core.c:2380
drop_ref drivers/hid/hidraw.c:343 [inline]
hidraw_release+0x4c3/0x750 drivers/hid/hidraw.c:367
__fput+0x22c/0x920 fs/file_table.c:320
task_work_run+0x1ca/0x250 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
input_mutex --> &dev->mutex#2 --> &hdev->ll_open_lock

Possible unsafe locking scenario:

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

*** DEADLOCK ***

2 locks held by syz.5.371/6216:
#0: ffffffff8d9a4e30 (minors_rwsem){++++}-{3:3}, at: hidraw_release+0x74/0x750 drivers/hid/hidraw.c:355
#1: ffff888052a01e18 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_close+0x2c/0xd0 drivers/hid/hid-core.c:2378

stack backtrace:
CPU: 1 PID: 6216 Comm: syz.5.371 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
check_noncircular+0x274/0x310 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 kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x120/0xaf0 kernel/locking/mutex.c:747
input_register_device+0xbc6/0x1310 drivers/input/input.c:2463
steam_input_register+0x9df/0xcb0 drivers/hid/hid-steam.c:469
hid_hw_close+0xa5/0xd0 drivers/hid/hid-core.c:2380
drop_ref drivers/hid/hidraw.c:343 [inline]
hidraw_release+0x4c3/0x750 drivers/hid/hidraw.c:367
__fput+0x22c/0x920 fs/file_table.c:320
task_work_run+0x1ca/0x250 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd2a178f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffece77c818 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 0000000000031316 RCX: 00007fd2a178f749
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fd2a19e7da0 R08: 0000000000000001 R09: 00000009ce77cb0f
R10: 0000001b32820000 R11: 0000000000000246 R12: 00007fd2a19e5fac
R13: 00007fd2a19e5fa0 R14: ffffffffffffffff R15: 00007ffece77c930
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages