====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.4.1128/10158 is trying to acquire lock: ffff888034acfe18 (kn->active#81){++++}-{0:0}, at: __kernfs_remove+0x34c/0xb80 fs/kernfs/dir.c:1579 but task is already holding lock: ffffffff904e2d60 (serio_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline] ffffffff904e2d60 (serio_mutex){+.+.}-{4:4}, at: serio_unregister_port+0x1b/0x40 drivers/input/serio/serio.c:677 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (serio_mutex){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 class_mutex_intr_constructor include/linux/mutex.h:255 [inline] drvctl_store+0x3c/0x350 drivers/input/serio/serio.c:360 dev_attr_store+0x58/0x80 drivers/base/core.c:2509 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6af/0x1050 fs/read_write.c:687 ksys_write+0x12a/0x250 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (kn->active#81){++++}-{0:0}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 kernfs_drain+0x4f0/0x600 fs/kernfs/dir.c:532 __kernfs_remove+0x34c/0xb80 fs/kernfs/dir.c:1579 kernfs_remove_by_name_ns+0x7c/0x120 fs/kernfs/dir.c:1797 kernfs_remove_by_name include/linux/kernfs.h:644 [inline] remove_files+0x96/0x1c0 fs/sysfs/group.c:28 sysfs_remove_group+0x8b/0x1b0 fs/sysfs/group.c:328 sysfs_remove_groups fs/sysfs/group.c:352 [inline] sysfs_remove_groups+0x60/0xb0 fs/sysfs/group.c:344 device_remove_groups drivers/base/core.c:2918 [inline] device_remove_attrs+0x192/0x290 drivers/base/core.c:3048 device_del+0x36e/0x9b0 drivers/base/core.c:3964 serio_destroy_port+0x47f/0x590 drivers/input/serio/serio.c:543 serio_unregister_port+0x2b/0x40 drivers/input/serio/serio.c:680 userio_char_release+0x91/0xe0 drivers/input/serio/userio.c:105 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x700 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline] do_syscall_64+0x661/0x790 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(serio_mutex); lock(kn->active#81); lock(serio_mutex); lock(kn->active#81); *** DEADLOCK *** locks held by syz.4.1128/10158: 1, last CPU#0: #0: ffffffff904e2d60 (serio_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline] #0: ffffffff904e2d60 (serio_mutex){+.+.}-{4:4}, at: serio_unregister_port+0x1b/0x40 drivers/input/serio/serio.c:677 stack backtrace: CPU: 0 UID: 0 PID: 10158 Comm: syz.4.1128 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2026 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 kernfs_drain+0x4f0/0x600 fs/kernfs/dir.c:532 __kernfs_remove+0x34c/0xb80 fs/kernfs/dir.c:1579 kernfs_remove_by_name_ns+0x7c/0x120 fs/kernfs/dir.c:1797 kernfs_remove_by_name include/linux/kernfs.h:644 [inline] remove_files+0x96/0x1c0 fs/sysfs/group.c:28 sysfs_remove_group+0x8b/0x1b0 fs/sysfs/group.c:328 sysfs_remove_groups fs/sysfs/group.c:352 [inline] sysfs_remove_groups+0x60/0xb0 fs/sysfs/group.c:344 device_remove_groups drivers/base/core.c:2918 [inline] device_remove_attrs+0x192/0x290 drivers/base/core.c:3048 device_del+0x36e/0x9b0 drivers/base/core.c:3964 serio_destroy_port+0x47f/0x590 drivers/input/serio/serio.c:543 serio_unregister_port+0x2b/0x40 drivers/input/serio/serio.c:680 userio_char_release+0x91/0xe0 drivers/input/serio/userio.c:105 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x700 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline] do_syscall_64+0x661/0x790 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f8177d9e159 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff13df5978 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007f8178027da0 RCX: 00007f8177d9e159 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007f8178027da0 R08: 0000000000000006 R09: 0000000000000000 R10: 00007f8178027cb0 R11: 0000000000000246 R12: 0000000000078419 R13: 00007f817802618c R14: 00000000000782f1 R15: 00007f8178026180