syzbot


possible deadlock in hid_hw_open

Status: upstream: reported on 2025/04/06 00:10
Reported-by: syzbot+37f6bbd63ea0eed0ffb8@syzkaller.appspotmail.com
First crash: 16d, last: 16d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in hid_hw_open input 73 76d 246d 0/28 auto-obsoleted due to no activity on 2025/04/15 13:39

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.179-syzkaller #0 Not tainted
------------------------------------------------------
acpid/3530 is trying to acquire lock:
ffff88807cda1ee0 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2118

but task is already holding lock:
ffff8880246c82c0 (&dev->mutex#2){+.+.}-{3:3}, at: input_open_device+0x4e/0x2d0 drivers/input/input.c:620

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&dev->mutex#2){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_interruptible_nested+0x17/0x20 kernel/locking/mutex.c:765
       input_register_handle+0x69/0x3a0 drivers/input/input.c:2588
       kbd_connect+0xbb/0x120 drivers/tty/vt/keyboard.c:1577
       input_attach_handler drivers/input/input.c:1046 [inline]
       input_register_device+0xdae/0x1150 drivers/input/input.c:2429
       acpi_button_add+0x62d/0x9f0 drivers/acpi/button.c:579
       acpi_device_probe+0xa3/0x2f0 drivers/acpi/bus.c:1013
       call_driver_probe drivers/base/dd.c:-1 [inline]
       really_probe+0x24e/0xb60 drivers/base/dd.c:595
       __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:755
       driver_probe_device+0x50/0x420 drivers/base/dd.c:785
       __driver_attach+0x479/0x690 drivers/base/dd.c:1164
       bus_for_each_dev+0x17c/0x1f0 drivers/base/bus.c:303
       bus_add_driver+0x334/0x600 drivers/base/bus.c:620
       driver_register+0x2bf/0x3a0 drivers/base/driver.c:240
       do_one_initcall+0x22b/0x7a0 init/main.c:1302
       do_initcall_level+0x157/0x210 init/main.c:1375
       do_initcalls+0x49/0x90 init/main.c:1391
       kernel_init_freeable+0x425/0x5c0 init/main.c:1615
       kernel_init+0x19/0x290 init/main.c:1506
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #1 (input_mutex){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_interruptible_nested+0x17/0x20 kernel/locking/mutex.c:765
       input_register_device+0xb81/0x1150 drivers/input/input.c:2422
       steam_input_register+0x947/0xbd0 drivers/hid/hid-steam.c:469
       hid_hw_close+0xa4/0xd0 drivers/hid/hid-core.c:2146
       drop_ref+0x9f/0x370 drivers/hid/hidraw.c:324
       hidraw_disconnect+0x4d/0x60 drivers/hid/hidraw.c:602
       hid_disconnect drivers/hid/hid-core.c:2058 [inline]
       hid_hw_stop+0xf7/0x1e0 drivers/hid/hid-core.c:2101
       hid_device_remove+0x21a/0x330 drivers/hid/hid-core.c:-1
       __device_release_driver drivers/base/dd.c:1227 [inline]
       device_release_driver_internal+0x4cb/0x7f0 drivers/base/dd.c:1262
       bus_remove_device+0x2e5/0x400 drivers/base/bus.c:531
       device_del+0x6e2/0xbd0 drivers/base/core.c:3600
       hid_remove_device drivers/hid/hid-core.c:2510 [inline]
       hid_destroy_device+0x64/0x100 drivers/hid/hid-core.c:2529
       steam_remove+0xa8/0x180 drivers/hid/hid-steam.c:823
       hid_device_remove+0x21a/0x330 drivers/hid/hid-core.c:-1
       __device_release_driver drivers/base/dd.c:1227 [inline]
       device_release_driver_internal+0x4cb/0x7f0 drivers/base/dd.c:1262
       bus_remove_device+0x2e5/0x400 drivers/base/bus.c:531
       device_del+0x6e2/0xbd0 drivers/base/core.c:3600
       hid_remove_device drivers/hid/hid-core.c:2510 [inline]
       hid_destroy_device+0x64/0x100 drivers/hid/hid-core.c:2529
       usbhid_disconnect+0x9a/0xc0 drivers/hid/usbhid/hid-core.c:1451
       usb_unbind_interface+0x1cd/0x840 drivers/usb/core/driver.c:458
       __device_release_driver drivers/base/dd.c:1229 [inline]
       device_release_driver_internal+0x50e/0x7f0 drivers/base/dd.c:1262
       bus_remove_device+0x2e5/0x400 drivers/base/bus.c:531
       device_del+0x6e2/0xbd0 drivers/base/core.c:3600
       usb_disable_device+0x3b8/0x840 drivers/usb/core/message.c:1414
       usb_disconnect+0x33c/0x8c0 drivers/usb/core/hub.c:2259
       hub_port_connect drivers/usb/core/hub.c:5311 [inline]
       hub_port_connect_change drivers/usb/core/hub.c:5607 [inline]
       port_event drivers/usb/core/hub.c:5753 [inline]
       hub_event+0x1d58/0x54c0 drivers/usb/core/hub.c:5835
       process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
       process_scheduled_works kernel/workqueue.c:2373 [inline]
       worker_thread+0xdcf/0x1280 kernel/workqueue.c:2459
       kthread+0x3f6/0x4f0 kernel/kthread.c:334
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

-> #0 (&hdev->ll_open_lock
){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758
       hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2118
       input_open_device+0x188/0x2d0 drivers/input/input.c:640
       evdev_open_device drivers/input/evdev.c:400 [inline]
       evdev_open+0x3ed/0x600 drivers/input/evdev.c:487
       chrdev_open+0x54a/0x630 fs/char_dev.c:414
       do_dentry_open+0x807/0xfb0 fs/open.c:826
       do_open fs/namei.c:3608 [inline]
       path_openat+0x2705/0x2f20 fs/namei.c:3742
       do_filp_open+0x21c/0x460 fs/namei.c:3769
       do_sys_openat2+0x13b/0x4f0 fs/open.c:1253
       do_sys_open fs/open.c:1269 [inline]
       __do_sys_openat fs/open.c:1285 [inline]
       __se_sys_openat fs/open.c:1280 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1280
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

2 locks held by acpid/3530:
 #0: ffff888066911110
 (&evdev->mutex){+.+.}-{3:3}, at: evdev_open_device drivers/input/evdev.c:393 [inline]
 (&evdev->mutex){+.+.}-{3:3}, at: evdev_open+0x2ec/0x600 drivers/input/evdev.c:487
 #1: ffff8880246c82c0 (&dev->mutex#2){+.+.}-{3:3}
, at: input_open_device+0x4e/0x2d0 drivers/input/input.c:620

stack backtrace:
CPU: 0 PID: 3530 Comm: acpid Not tainted 5.15.179-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/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758
 hid_hw_open+0x24/0x160 drivers/hid/hid-core.c:2118
 input_open_device+0x188/0x2d0 drivers/input/input.c:640
 evdev_open_device drivers/input/evdev.c:400 [inline]
 evdev_open+0x3ed/0x600 drivers/input/evdev.c:487
 chrdev_open+0x54a/0x630 fs/char_dev.c:414
 do_dentry_open+0x807/0xfb0 fs/open.c:826
 do_open fs/namei.c:3608 [inline]
 path_openat+0x2705/0x2f20 fs/namei.c:3742
 do_filp_open+0x21c/0x460 fs/namei.c:3769
 do_sys_openat2+0x13b/0x4f0 fs/open.c:1253
 do_sys_open fs/open.c:1269 [inline]
 __do_sys_openat fs/open.c:1285 [inline]
 __se_sys_openat fs/open.c:1280 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1280
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f1c76b159a4
Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffe81c6e330 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ffe81c6e618 RCX: 00007f1c76b159a4
RDX: 0000000000080800 RSI: 00007ffe81c6e518 RDI: 00000000ffffff9c
RBP: 00007ffe81c6e518 R08: 00000000000000f4 R09: 00007ffe81c6e518
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080800
R13: 0000000000000040 R14: 00007ffe81c6e618 R15: 00007ffe81c6e518
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/06 00:09 linux-5.15.y 0c935c049b5c 1c65791e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hid_hw_open
* Struck through repros no longer work on HEAD.