syzbot


possible deadlock in input_ff_flush

Status: upstream: reported C repro on 2025/01/05 12:40
Subsystems: input
[Documentation on labels]
Reported-by: syzbot+ed7c6209f62eba1565aa@syzkaller.appspotmail.com
First crash: 298d, last: 3d16h
Cause bisection: introduced by (bisect log) [merge commit]:
commit af96134dc8562f9fcbb8358af36f6086619a29ab
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Tue Jun 27 17:37:01 2023 +0000

  Merge tag 'rcu.2023.06.22a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu

Crash: possible deadlock in input_ff_flush (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly input report (Oct 2025) 0 (1) 2025/10/16 08:36
[syzbot] [input?] possible deadlock in input_ff_flush 3 (8) 2025/07/27 04:48
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in input_ff_flush 4 1 89d 89d 0/3 upstream: reported on 2025/07/29 04:52
Last patch testing requests (10)
Created Duration User Patch Repo Result
2025/08/13 14:50 20m retest repro upstream report log
2025/08/09 19:03 1h20m retest repro upstream report log
2025/08/09 18:49 20m retest repro upstream error
2025/07/27 03:59 34m hdanton@sina.com patch upstream OK log
2025/06/04 14:14 13m retest repro upstream report log
2025/05/17 23:45 24m retest repro upstream report log
2025/03/26 13:09 31m retest repro upstream report log
2025/01/15 12:45 17m retest repro upstream report log
2025/01/06 11:08 17m hdanton@sina.com patch upstream report log
2025/01/06 10:29 19m hdanton@sina.com patch upstream error
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/10/11 14:36 2h20m bisect fix upstream OK (0) job log log
2025/09/11 01:09 3h24m bisect fix upstream OK (0) job log log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
udevd/5949 is trying to acquire lock:
ffff888026fa88b0 (&ff->mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:228 [inline]
ffff888026fa88b0 (&ff->mutex){+.+.}-{4:4}, at: input_ff_flush+0x5d/0x170 drivers/input/ff-core.c:231

but task is already holding lock:
ffff888026bfb2c0 (&dev->mutex#2){+.+.}-{4:4}, at: class_mutex_intr_constructor include/linux/mutex.h:230 [inline]
ffff888026bfb2c0 (&dev->mutex#2){+.+.}-{4:4}, at: input_flush_device+0x51/0x110 drivers/input/input.c:626

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&dev->mutex#2){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/mutex.c:598 [inline]
       __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760
       class_mutex_intr_constructor include/linux/mutex.h:230 [inline]
       input_register_handle+0x18f/0x530 drivers/input/input.c:2619
       kbd_connect+0xc3/0x140 drivers/tty/vt/keyboard.c:1580
       input_attach_handler drivers/input/input.c:994 [inline]
       input_register_device+0xd00/0x1140 drivers/input/input.c:2378
       acpi_button_add+0x6b1/0xb50 drivers/acpi/button.c:621
       acpi_device_probe+0xa8/0x2d0 drivers/acpi/bus.c:1076
       call_driver_probe drivers/base/dd.c:-1 [inline]
       really_probe+0x26d/0x9e0 drivers/base/dd.c:659
       __driver_probe_device+0x18c/0x2f0 drivers/base/dd.c:801
       driver_probe_device+0x4f/0x430 drivers/base/dd.c:831
       __driver_attach+0x452/0x700 drivers/base/dd.c:1217
       bus_for_each_dev+0x233/0x2b0 drivers/base/bus.c:370
       bus_add_driver+0x345/0x640 drivers/base/bus.c:678
       driver_register+0x23a/0x320 drivers/base/driver.c:249
       do_one_initcall+0x236/0x820 init/main.c:1283
       do_initcall_level+0x104/0x190 init/main.c:1345
       do_initcalls+0x59/0xa0 init/main.c:1361
       kernel_init_freeable+0x334/0x4b0 init/main.c:1593
       kernel_init+0x1d/0x1d0 init/main.c:1483
       ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #2 (input_mutex){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/mutex.c:598 [inline]
       __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760
       class_mutex_intr_constructor include/linux/mutex.h:230 [inline]
       input_register_device+0xa76/0x1140 drivers/input/input.c:2374
       uinput_create_device+0x422/0x670 drivers/input/misc/uinput.c:365
       uinput_ioctl_handler+0x3f0/0x1570 drivers/input/misc/uinput.c:919
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:597 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&newdev->mutex){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/mutex.c:598 [inline]
       __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760
       uinput_request_send drivers/input/misc/uinput.c:151 [inline]
       uinput_request_submit+0x188/0x6f0 drivers/input/misc/uinput.c:182
       uinput_dev_upload_effect+0x150/0x1e0 drivers/input/misc/uinput.c:257
       input_ff_upload+0x5fb/0xb30 drivers/input/ff-core.c:148
       evdev_do_ioctl drivers/input/evdev.c:1181 [inline]
       evdev_ioctl_handler+0x1644/0x1f10 drivers/input/evdev.c:1270
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:597 [inline]
       __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ff->mutex){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/mutex.c:598 [inline]
       __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760
       class_mutex_constructor include/linux/mutex.h:228 [inline]
       input_ff_flush+0x5d/0x170 drivers/input/ff-core.c:231
       input_flush_device+0xb4/0x110 drivers/input/input.c:628
       evdev_release+0xe1/0x800 drivers/input/evdev.c:435
       __fput+0x44c/0xa70 fs/file_table.c:468
       fput_close_sync+0x119/0x200 fs/file_table.c:573
       __do_sys_close fs/open.c:1589 [inline]
       __se_sys_close fs/open.c:1574 [inline]
       __x64_sys_close+0x7f/0x110 fs/open.c:1574
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

2 locks held by udevd/5949:
 #0: ffff88823bfe4118 (&evdev->mutex){+.+.}-{4:4}, at: evdev_release+0x73/0x800 drivers/input/evdev.c:432
 #1: ffff888026bfb2c0 (&dev->mutex#2){+.+.}-{4:4}, at: class_mutex_intr_constructor include/linux/mutex.h:230 [inline]
 #1: ffff888026bfb2c0 (&dev->mutex#2){+.+.}-{4:4}, at: input_flush_device+0x51/0x110 drivers/input/input.c:626

stack backtrace:
CPU: 0 UID: 0 PID: 5949 Comm: udevd Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3165 [inline]
 check_prevs_add kernel/locking/lockdep.c:3284 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 __mutex_lock_common kernel/locking/mutex.c:598 [inline]
 __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760
 class_mutex_constructor include/linux/mutex.h:228 [inline]
 input_ff_flush+0x5d/0x170 drivers/input/ff-core.c:231
 input_flush_device+0xb4/0x110 drivers/input/input.c:628
 evdev_release+0xe1/0x800 drivers/input/evdev.c:435
 __fput+0x44c/0xa70 fs/file_table.c:468
 fput_close_sync+0x119/0x200 fs/file_table.c:573
 __do_sys_close fs/open.c:1589 [inline]
 __se_sys_close fs/open.c:1574 [inline]
 __x64_sys_close+0x7f/0x110 fs/open.c:1574
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc6f9aa7407
Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff016cd120 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 00007fc6fa17d880 RCX: 00007fc6f9aa7407
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 00007fc6fa17d6e8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000016
R13: 00007fff016cd230 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/23 08:22 upstream dd72c8fcf6d3 c0460fcd .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in input_ff_flush
2025/07/26 18:46 upstream 5f33ebd2018c fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in input_ff_flush
2025/05/03 22:36 upstream 95d3481af6dc b0714e37 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in input_ff_flush
2025/01/01 12:32 upstream ccb98ccef0e5 d3ccff63 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in input_ff_flush
* Struck through repros no longer work on HEAD.