====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:0/9 is trying to acquire lock: ffff8880360192a8 (&tty->termios_rwsem){++++}-{4:4}, at: class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] ffff8880360192a8 (&tty->termios_rwsem){++++}-{4:4}, at: n_tty_flush_buffer+0x2f/0x260 drivers/tty/n_tty.c:349 but task is already holding lock: ffff88813fe800b0 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&buf->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:534 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:553 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xed/0x6a0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work+0x9a3/0x1710 kernel/workqueue.c:3312 process_scheduled_works kernel/workqueue.c:3403 [inline] worker_thread+0xba8/0x11e0 kernel/workqueue.c:3489 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (console_lock){+.+.}-{0:0}: console_lock+0x76/0x90 kernel/printk/printk.c:2896 uart_configure_port drivers/tty/serial/serial_core.c:2522 [inline] serial_core_add_one_port drivers/tty/serial/serial_core.c:3086 [inline] serial_core_register_port+0xc40/0x2810 drivers/tty/serial/serial_core.c:3307 serial8250_register_8250_port+0x167e/0x1fd0 drivers/tty/serial/8250/8250_core.c:822 serial_pnp_probe+0x56e/0x800 drivers/tty/serial/8250/8250_pnp.c:480 pnp_device_probe+0x30b/0x4c0 drivers/pnp/driver.c:111 call_driver_probe drivers/base/dd.c:-1 [inline] really_probe+0x267/0xaf0 drivers/base/dd.c:709 __driver_probe_device+0x1ef/0x380 drivers/base/dd.c:871 driver_probe_device+0x4f/0x240 drivers/base/dd.c:901 __driver_attach+0x34c/0x640 drivers/base/dd.c:1295 bus_for_each_dev+0x23e/0x2c0 drivers/base/bus.c:383 bus_add_driver+0x348/0x670 drivers/base/bus.c:756 driver_register+0x23a/0x320 drivers/base/driver.c:249 serial8250_init+0x8f/0x160 drivers/tty/serial/8250/8250_platform.c:317 do_one_initcall+0x250/0x870 init/main.c:1392 do_initcall_level+0x104/0x190 init/main.c:1454 do_initcalls+0x59/0xa0 init/main.c:1470 kernel_init_freeable+0x2a6/0x3e0 init/main.c:1703 kernel_init+0x1d/0x1d0 init/main.c:1593 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 (&port->mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/rtmutex_api.c:534 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:553 class_mutex_constructor include/linux/mutex.h:253 [inline] uart_set_termios+0x83/0x1310 drivers/tty/serial/serial_core.c:1649 tty_set_termios+0xcb7/0x1800 drivers/tty/tty_ioctl.c:341 set_termios+0x566/0x710 drivers/tty/tty_ioctl.c:516 tty_mode_ioctl+0x4a6/0x7d0 drivers/tty/tty_ioctl.c:-1 tty_ioctl+0x9cb/0xde0 drivers/tty/tty_io.c:2801 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xff/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tty->termios_rwsem){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3167 [inline] check_prevs_add kernel/locking/lockdep.c:3286 [inline] validate_chain kernel/locking/lockdep.c:3910 [inline] __lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5239 lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5870 down_write+0x3a/0x50 kernel/locking/rwsem.c:1625 class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] n_tty_flush_buffer+0x2f/0x260 drivers/tty/n_tty.c:349 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:248 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xed/0x6a0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work+0x9a3/0x1710 kernel/workqueue.c:3312 process_scheduled_works kernel/workqueue.c:3403 [inline] worker_thread+0xba8/0x11e0 kernel/workqueue.c:3489 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: &tty->termios_rwsem --> console_lock --> &buf->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&buf->lock); lock(console_lock); lock(&buf->lock); lock(&tty->termios_rwsem); *** DEADLOCK *** 5 locks held by kworker/0:0/9: #0: ffff88813fe3b938 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x890/0x1710 kernel/workqueue.c:3284 #1: ffffc900000e7c40 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work+0x8b7/0x1710 kernel/workqueue.c:3285 #2: ffffffff8dfba3a0 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:736 [inline] #2: ffffffff8dfba3a0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:985 #3: ffff8880360190a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff8880360190a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x20/0xc0 drivers/tty/tty_ldisc.c:386 #4: ffff88813fe800b0 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 stack backtrace: CPU: 0 UID: 0 PID: 9 Comm: kworker/0:0 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/18/2026 Workqueue: events vc_SAK Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2045 check_noncircular+0x12e/0x150 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3167 [inline] check_prevs_add kernel/locking/lockdep.c:3286 [inline] validate_chain kernel/locking/lockdep.c:3910 [inline] __lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5239 lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5870 down_write+0x3a/0x50 kernel/locking/rwsem.c:1625 class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] n_tty_flush_buffer+0x2f/0x260 drivers/tty/n_tty.c:349 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:248 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xed/0x6a0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work+0x9a3/0x1710 kernel/workqueue.c:3312 process_scheduled_works kernel/workqueue.c:3403 [inline] worker_thread+0xba8/0x11e0 kernel/workqueue.c:3489 kthread+0x388/0x470 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 tty tty1: SAK: killed process 6699 (syz.0.16): by fd#3 tty tty1: SAK: killed process 6700 (syz.0.16): by fd#3 tty tty1: SAK: killed process 6729 (syz.0.31): by fd#3 tty tty1: SAK: killed process 6730 (syz.0.31): by fd#3 tty tty1: SAK: killed process 6781 (syz.0.57): by fd#3 tty tty1: SAK: killed process 6782 (syz.0.57): by fd#3 tty tty1: SAK: killed process 6783 (syz.0.58): by fd#3 tty tty1: SAK: killed process 6784 (syz.0.58): by fd#3 tty tty1: SAK: killed process 6789 (syz.0.61): by fd#3 tty tty1: SAK: killed process 6790 (syz.0.61): by fd#3 tty tty1: SAK: killed process 6791 (syz.0.62): by fd#3 tty tty1: SAK: killed process 6792 (syz.0.62): by fd#3 tty tty1: SAK: killed process 6793 (syz.0.63): by fd#3 tty tty1: SAK: killed process 6794 (syz.0.63): by fd#3 tty tty1: SAK: killed process 6841 (syz.0.87): by fd#3 tty tty1: SAK: killed process 6893 (syz.0.113): by fd#3 tty tty1: SAK: killed process 6894 (syz.0.113): by fd#3 tty tty1: SAK: killed process 6897 (syz.0.115): by fd#3 tty tty1: SAK: killed process 6898 (syz.0.115): by fd#3 tty tty1: SAK: killed process 6911 (syz.0.122): by fd#3 tty tty1: SAK: killed process 6912 (syz.0.122): by fd#3 tty tty1: SAK: killed process 6919 (syz.0.126): by fd#3