syzbot


possible deadlock in hid_hw_open

Status: upstream: reported on 2024/08/18 09:24
Subsystems: input
[Documentation on labels]
Reported-by: syzbot+2313ca2498b9554beeba@syzkaller.appspotmail.com
First crash: 98d, last: 1d00h
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly input report (Sep 2024) 0 (1) 2024/09/02 08:17
[syzbot] [input?] [usb?] possible deadlock in hid_hw_open 0 (1) 2024/08/18 09:24

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc6-syzkaller-00077-g2e1b3cc9d7f7 #0 Not tainted
------------------------------------------------------
syz.4.751/8817 is trying to acquire lock:
ffff888022b15e20 (&hdev->ll_open_lock){+.+.}-{3:3}, at: hid_hw_open+0x28/0x170 drivers/hid/hid-core.c:2386

but task is already holding lock:
ffff888062f142c0 (&dev->mutex#2){+.+.}-{3:3}, at: input_open_device+0x52/0x2e0 drivers/input/input.c:597

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&dev->mutex#2){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       input_disconnect_device drivers/input/input.c:724 [inline]
       __input_unregister_device+0x31/0x620 drivers/input/input.c:2270
       input_unregister_device+0xa3/0x100 drivers/input/input.c:2511
       steam_client_ll_open+0x88/0xa0 drivers/hid/hid-steam.c:1121
       hid_hw_open+0xe3/0x170 drivers/hid/hid-core.c:2391
       hidraw_open+0x298/0x8e0 drivers/hid/hidraw.c:308
       chrdev_open+0x521/0x600 fs/char_dev.c:414
       do_dentry_open+0x978/0x1460 fs/open.c:958
       vfs_open+0x3e/0x330 fs/open.c:1088
       do_open fs/namei.c:3774 [inline]
       path_openat+0x2c84/0x3590 fs/namei.c:3933
       do_filp_open+0x235/0x490 fs/namei.c:3960
       do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
       do_sys_open fs/open.c:1430 [inline]
       __do_sys_openat fs/open.c:1446 [inline]
       __se_sys_openat fs/open.c:1441 [inline]
       __x64_sys_openat+0x247/0x2a0 fs/open.c:1441
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&hdev->ll_open_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       hid_hw_open+0x28/0x170 drivers/hid/hid-core.c:2386
       input_open_device+0x191/0x2e0 drivers/input/input.c:617
       evdev_open_device drivers/input/evdev.c:391 [inline]
       evdev_open+0x3e0/0x5f0 drivers/input/evdev.c:478
       chrdev_open+0x521/0x600 fs/char_dev.c:414
       do_dentry_open+0x978/0x1460 fs/open.c:958
       vfs_open+0x3e/0x330 fs/open.c:1088
       do_open fs/namei.c:3774 [inline]
       path_openat+0x2c84/0x3590 fs/namei.c:3933
       do_filp_open+0x235/0x490 fs/namei.c:3960
       do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
       do_sys_open fs/open.c:1430 [inline]
       __do_sys_openat fs/open.c:1446 [inline]
       __se_sys_openat fs/open.c:1441 [inline]
       __x64_sys_openat+0x247/0x2a0 fs/open.c:1441
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

2 locks held by syz.4.751/8817:
 #0: ffff88805357b118 (&evdev->mutex){+.+.}-{3:3}, at: evdev_open_device drivers/input/evdev.c:384 [inline]
 #0: ffff88805357b118 (&evdev->mutex){+.+.}-{3:3}, at: evdev_open+0x2e9/0x5f0 drivers/input/evdev.c:478
 #1: ffff888062f142c0 (&dev->mutex#2){+.+.}-{3:3}, at: input_open_device+0x52/0x2e0 drivers/input/input.c:597

stack backtrace:
CPU: 1 UID: 0 PID: 8817 Comm: syz.4.751 Not tainted 6.12.0-rc6-syzkaller-00077-g2e1b3cc9d7f7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206
 check_prev_add kernel/locking/lockdep.c:3161 [inline]
 check_prevs_add kernel/locking/lockdep.c:3280 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
 hid_hw_open+0x28/0x170 drivers/hid/hid-core.c:2386
 input_open_device+0x191/0x2e0 drivers/input/input.c:617
 evdev_open_device drivers/input/evdev.c:391 [inline]
 evdev_open+0x3e0/0x5f0 drivers/input/evdev.c:478
 chrdev_open+0x521/0x600 fs/char_dev.c:414
 do_dentry_open+0x978/0x1460 fs/open.c:958
 vfs_open+0x3e/0x330 fs/open.c:1088
 do_open fs/namei.c:3774 [inline]
 path_openat+0x2c84/0x3590 fs/namei.c:3933
 do_filp_open+0x235/0x490 fs/namei.c:3960
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415
 do_sys_open fs/open.c:1430 [inline]
 __do_sys_openat fs/open.c:1446 [inline]
 __se_sys_openat fs/open.c:1441 [inline]
 __x64_sys_openat+0x247/0x2a0 fs/open.c:1441
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7efcfd17d0b0
Code: 48 89 44 24 20 75 93 44 89 54 24 0c e8 19 8f 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 6c 8f 02 00 8b 44
RSP: 002b:00007efcfb5f5b70 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007efcfd17d0b0
RDX: 0000000000000000 RSI: 00007efcfb5f5c10 RDI: 00000000ffffff9c
RBP: 00007efcfb5f5c10 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000000 R14: 00007efcfd335f80 R15: 00007ffe5c9e1c38
 </TASK>
netlink: 8 bytes leftover after parsing attributes in process `syz.4.751'.
UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy
misc raw-gadget: fail, usb_gadget_register_driver returned -16

Crashes (45):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/06 16:15 upstream 2e1b3cc9d7f7 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in hid_hw_open
2024/11/03 22:37 upstream b9021de3ec2f f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in hid_hw_open
2024/10/04 02:55 upstream 3840cbe24cf0 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in hid_hw_open
2024/09/19 02:25 upstream 4a39ac5b7d62 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in hid_hw_open
2024/09/13 11:04 upstream 196145c606d0 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in hid_hw_open
2024/09/26 10:18 upstream aa486552a110 0d19f247 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in hid_hw_open
2024/09/26 10:13 upstream aa486552a110 0d19f247 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in hid_hw_open
2024/11/20 05:35 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 237d4e0f4113 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/26 16:03 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing c6d9e43954bf 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/26 10:00 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing c6d9e43954bf 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/20 00:16 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 07b887f8236e cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/17 17:17 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 07b887f8236e 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/13 00:20 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 4a9fe2a8ac53 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/11 01:36 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 4a9fe2a8ac53 8fbfc0c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/09 09:20 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 4a9fe2a8ac53 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/09 09:04 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 4a9fe2a8ac53 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/10/02 18:31 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 9852d85ec9d4 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/26 20:38 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/23 19:29 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 89298aad .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/23 05:40 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/21 17:04 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/21 04:43 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/19 20:05 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/19 17:58 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/18 20:19 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/18 19:19 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/18 05:11 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/17 05:18 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/15 04:24 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 68d4209158f4 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/13 12:22 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 2193ede180dd 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/12 05:59 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 761fd871015f d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/10 12:25 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing f299cd11f753 784df80e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/09 04:08 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 9c0c11bb87b0 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/08 20:45 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 9c0c11bb87b0 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/04 10:56 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing d40ae4cdd9a4 9d47f20a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/09/03 05:35 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 8045124c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/29 14:52 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 9bd464fc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/29 09:41 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 ef3de9e8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/28 11:56 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/27 21:53 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/27 03:58 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 9aee4e0b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/26 19:00 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing fc88bb116179 9aee4e0b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/18 18:35 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 82313624b2ae dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/15 12:40 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 82313624b2ae e4bacdaf .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
2024/08/14 09:19 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 82313624b2ae 07a4d4ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb possible deadlock in hid_hw_open
* Struck through repros no longer work on HEAD.