keytouch 0003:0926:3333.0018: input,hidraw0: USB HID v0.00 Keyboard [HID 0926:3333] on usb-dummy_hcd.3-1/input0 usb 6-1: USB disconnect, device number 18 ====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0 Not tainted ------------------------------------------------------ kworker/1:7/7735 is trying to acquire lock: ffff88801aca10b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x79/0x3f0 drivers/tty/tty_buffer.c:229 but task is already holding lock: ffffffff8e8134a0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x29/0x210 drivers/tty/vt/vt_ioctl.c:983 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (console_lock){+.+.}-{0:0}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 console_lock+0x164/0x1b0 kernel/printk/printk.c:2833 con_flush_chars+0x6f/0x270 drivers/tty/vt/vt.c:3503 n_tty_write+0xf2e/0x1230 drivers/tty/n_tty.c:2405 iterate_tty_write drivers/tty/tty_io.c:1015 [inline] file_tty_write+0x546/0x9b0 drivers/tty/tty_io.c:1090 new_sync_write fs/read_write.c:586 [inline] vfs_write+0xaeb/0xd30 fs/read_write.c:679 ksys_write+0x18f/0x2b0 fs/read_write.c:731 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 -> #1 (&tty->termios_rwsem){++++}-{4:4}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 down_write+0x99/0x220 kernel/locking/rwsem.c:1577 n_tty_flush_buffer+0x31/0x240 drivers/tty/n_tty.c:358 tty_buffer_flush+0x32c/0x3f0 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:388 tty_port_close_start+0x2e2/0x540 drivers/tty/tty_port.c:663 tty_port_close+0x28/0x140 drivers/tty/tty_port.c:718 tty_release+0x32a/0x12c0 drivers/tty/tty_io.c:1754 __fput+0x23c/0xa50 fs/file_table.c:450 task_work_run+0x24f/0x310 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0xa2a/0x28e0 kernel/exit.c:938 do_group_exit+0x207/0x2c0 kernel/exit.c:1087 get_signal+0x16b2/0x1750 kernel/signal.c:3017 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xce/0x340 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&buf->lock){+.+.}-{4:4}: 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+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 tty_buffer_flush+0x79/0x3f0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x27a/0x700 drivers/tty/tty_io.c:3038 vc_SAK+0x77/0x210 drivers/tty/vt/vt_ioctl.c:993 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 other info that might help us debug this: Chain exists of: &buf->lock --> &tty->termios_rwsem --> console_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(console_lock); lock(&tty->termios_rwsem); lock(console_lock); lock(&buf->lock); *** DEADLOCK *** 4 locks held by kworker/1:7/7735: #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline] #0: ffff88801ac80948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1840 kernel/workqueue.c:3310 #1: ffffc9000bf8fd00 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline] #1: ffffc9000bf8fd00 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1840 kernel/workqueue.c:3310 #2: ffffffff8e8134a0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x29/0x210 drivers/tty/vt/vt_ioctl.c:983 #3: ffff8880315a30a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff8880315a30a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x1f/0xc0 drivers/tty/tty_ldisc.c:386 stack backtrace: CPU: 1 UID: 0 PID: 7735 Comm: kworker/1:7 Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: events vc_SAK Call Trace: __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+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 tty_buffer_flush+0x79/0x3f0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x27a/0x700 drivers/tty/tty_io.c:3038 vc_SAK+0x77/0x210 drivers/tty/vt/vt_ioctl.c:993 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 tty tty1: SAK: killed process 8320 (syz.1.632): by fd#6