====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.146/6657 is trying to acquire lock: ffff88805740da58 (kn->active#65){++++}-{0:0}, at: __kernfs_remove+0x493/0x8e0 fs/kernfs/dir.c:1565 but task is already holding lock: ffffffff8fcc64c0 (serio_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline] ffffffff8fcc64c0 (serio_mutex){+.+.}-{4:4}, at: serio_unregister_port+0x2f/0x150 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}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 class_mutex_intr_constructor include/linux/mutex.h:255 [inline] drvctl_store+0x35/0x11e0 drivers/input/serio/serio.c:360 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (kn->active#65){++++}-{0:0}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 kernfs_drain+0x293/0x640 fs/kernfs/dir.c:532 __kernfs_remove+0x493/0x8e0 fs/kernfs/dir.c:1565 kernfs_remove_by_name_ns+0xc0/0x140 fs/kernfs/dir.c:1783 kernfs_remove_by_name include/linux/kernfs.h:644 [inline] remove_files fs/sysfs/group.c:28 [inline] sysfs_remove_group+0x101/0x2e0 fs/sysfs/group.c:328 sysfs_remove_groups+0x54/0xb0 fs/sysfs/group.c:352 device_remove_groups drivers/base/core.c:2918 [inline] device_remove_attrs+0x1cb/0x280 drivers/base/core.c:3048 device_del+0x51c/0x8f0 drivers/base/core.c:3964 serio_destroy_port+0x57a/0x840 drivers/input/serio/serio.c:543 serio_unregister_port+0x130/0x150 drivers/input/serio/serio.c:680 userio_char_release+0x80/0xc0 drivers/input/serio/userio.c:105 __fput+0x413/0xa50 fs/file_table.c:513 task_work_run+0x1d9/0x260 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+0x204/0x770 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+0x328/0x520 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#65); lock(serio_mutex); lock(kn->active#65); *** DEADLOCK *** locks held by syz.0.146/6657: 1, last CPU#1: #0: ffffffff8fcc64c0 (serio_mutex){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:253 [inline] #0: ffffffff8fcc64c0 (serio_mutex){+.+.}-{4:4}, at: serio_unregister_port+0x2f/0x150 drivers/input/serio/serio.c:677 stack backtrace: CPU: 1 UID: 0 PID: 6657 Comm: syz.0.146 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 kernfs_drain+0x293/0x640 fs/kernfs/dir.c:532 __kernfs_remove+0x493/0x8e0 fs/kernfs/dir.c:1565 kernfs_remove_by_name_ns+0xc0/0x140 fs/kernfs/dir.c:1783 kernfs_remove_by_name include/linux/kernfs.h:644 [inline] remove_files fs/sysfs/group.c:28 [inline] sysfs_remove_group+0x101/0x2e0 fs/sysfs/group.c:328 sysfs_remove_groups+0x54/0xb0 fs/sysfs/group.c:352 device_remove_groups drivers/base/core.c:2918 [inline] device_remove_attrs+0x1cb/0x280 drivers/base/core.c:3048 device_del+0x51c/0x8f0 drivers/base/core.c:3964 serio_destroy_port+0x57a/0x840 drivers/input/serio/serio.c:543 serio_unregister_port+0x130/0x150 drivers/input/serio/serio.c:680 userio_char_release+0x80/0xc0 drivers/input/serio/userio.c:105 __fput+0x413/0xa50 fs/file_table.c:513 task_work_run+0x1d9/0x260 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+0x204/0x770 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+0x328/0x520 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa25c59e159 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:00007ffdaea781b8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fa25c827da0 RCX: 00007fa25c59e159 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fa25c827da0 R08: 0000000000000006 R09: 0000000000000000 R10: 00007fa25c827cb0 R11: 0000000000000246 R12: 0000000000065476 R13: 00007fa25c82609c R14: 0000000000065253 R15: 00007fa25c826090