====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:0/9 is trying to acquire lock: ffff88807b5e82e8 (&tty->termios_rwsem){++++}-{4:4}, at: n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:352 but task is already holding lock: ffff88813ff210b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&buf->lock){+.+.}-{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 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xf2/0x6e0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 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 (console_lock){+.+.}-{0:0}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 console_lock+0x76/0x90 kernel/printk/printk.c:2822 uart_configure_port drivers/tty/serial/serial_core.c:2547 [inline] serial_core_add_one_port drivers/tty/serial/serial_core.c:3105 [inline] serial_core_register_port+0xbe1/0x2800 drivers/tty/serial/serial_core.c:3331 serial8250_register_8250_port+0x16db/0x2080 drivers/tty/serial/8250/8250_core.c:818 serial_pnp_probe+0x527/0x790 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+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 serial8250_init+0x8f/0x160 drivers/tty/serial/8250/8250_platform.c:320 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 -> #1 (&port->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_constructor include/linux/mutex.h:228 [inline] uart_set_termios+0x82/0x730 drivers/tty/serial/serial_core.c:1670 tty_set_termios+0xca8/0x17e0 drivers/tty/tty_ioctl.c:341 set_termios+0x516/0x6c0 drivers/tty/tty_ioctl.c:516 tty_mode_ioctl+0x47e/0x740 drivers/tty/tty_ioctl.c:-1 tty_ioctl+0x9c6/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+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 (&tty->termios_rwsem){++++}-{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 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:352 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xf2/0x6e0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x4bc/0x870 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: ffff88813ff41548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3238 [inline] #0: ffff88813ff41548 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0 kernel/workqueue.c:3346 #1: ffffc900000e7ba0 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3239 [inline] #1: ffffc900000e7ba0 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0 kernel/workqueue.c:3346 #2: ffffffff8e331680 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:669 [inline] #2: ffffffff8e331680 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:985 #3: ffff88807b5e80a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff88807b5e80a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x20/0xc0 drivers/tty/tty_ldisc.c:386 #4: ffff88813ff210b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 stack backtrace: CPU: 0 UID: 0 PID: 9 Comm: kworker/0:0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Workqueue: events vc_SAK Call Trace: 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 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:352 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xf2/0x6e0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 tty tty1: SAK: killed process 6483 (syz.0.16): by fd#3 tty tty1: SAK: killed process 6484 (syz.0.16): by fd#3 tty tty1: SAK: killed process 6494 (syz.0.18): by fd#3 tty tty1: SAK: killed process 6495 (syz.0.18): by fd#3 tty tty1: SAK: killed process 6500 (syz.0.21): by fd#3 tty tty1: SAK: killed process 6501 (syz.0.21): by fd#3 tty tty1: SAK: killed process 6502 (syz.0.22): by fd#3 tty tty1: SAK: killed process 6503 (syz.0.22): by fd#3 tty tty1: SAK: killed process 6504 (syz.0.23): by fd#3 tty tty1: SAK: killed process 6505 (syz.0.23): by fd#3 tty tty1: SAK: killed process 6508 (syz.0.25): by fd#3 tty tty1: SAK: killed process 6509 (syz.0.25): by fd#3 tty tty1: SAK: killed process 6510 (syz.0.26): by fd#3 tty tty1: SAK: killed process 6511 (syz.0.26): by fd#3 tty tty1: SAK: killed process 6512 (syz.0.27): by fd#3 tty tty1: SAK: killed process 6513 (syz.0.27): by fd#3 tty tty1: SAK: killed process 6524 (syz.0.33): by fd#3 tty tty1: SAK: killed process 6525 (syz.0.33): by fd#3 tty tty1: SAK: killed process 6528 (syz.0.35): by fd#3 tty tty1: SAK: killed process 6529 (syz.0.35): by fd#3 tty tty1: SAK: killed process 6550 (syz.0.46): by fd#3 tty tty1: SAK: killed process 6551 (syz.0.46): by fd#3 tty tty1: SAK: killed process 6556 (syz.0.49): by fd#3 tty tty1: SAK: killed process 6557 (syz.0.49): by fd#3 tty tty1: SAK: killed process 6564 (syz.0.53): by fd#3 tty tty1: SAK: killed process 6565 (syz.0.53): by fd#3 tty tty1: SAK: killed process 6566 (syz.0.54): by fd#3 tty tty1: SAK: killed process 6567 (syz.0.54): by fd#3 tty tty1: SAK: killed process 6702 (syz.0.122): by fd#3 tty tty1: SAK: killed process 6703 (syz.0.122): by fd#3 tty tty1: SAK: killed process 6704 (syz.0.123): by fd#3 tty tty1: SAK: killed process 6705 (syz.0.123): by fd#3 tty tty1: SAK: killed process 6706 (syz.0.124): by fd#3 tty tty1: SAK: killed process 6707 (syz.0.124): by fd#3 tty tty1: SAK: killed process 6748 (syz.0.145): by fd#3 tty tty1: SAK: killed process 6749 (syz.0.145): by fd#3 tty tty1: SAK: killed process 6774 (syz.0.158): by fd#3 tty tty1: SAK: killed process 6775 (syz.0.158): by fd#3 tty tty1: SAK: killed process 6780 (syz.0.161): by fd#3 tty tty1: SAK: killed process 6781 (syz.0.161): by fd#3 tty tty1: SAK: killed process 6784 (syz.0.163): by fd#3 tty tty1: SAK: killed process 6785 (syz.0.163): by fd#3 tty tty1: SAK: killed process 6806 (syz.0.174): by fd#3 tty tty1: SAK: killed process 6807 (syz.0.174): by fd#3 tty tty1: SAK: killed process 6816 (syz.0.179): by fd#3 tty tty1: SAK: killed process 6817 (syz.0.179): by fd#3 tty tty1: SAK: killed process 6820 (syz.0.181): by fd#3 tty tty1: SAK: killed process 6821 (syz.0.181): by fd#3 tty tty1: SAK: killed process 6822 (syz.0.182): by fd#3 tty tty1: SAK: killed process 6823 (syz.0.182): by fd#3 tty tty1: SAK: killed process 6832 (syz.0.187): by fd#3 tty tty1: SAK: killed process 6833 (syz.0.187): by fd#3 tty tty1: SAK: killed process 6838 (syz.0.190): by fd#3 tty tty1: SAK: killed process 6839 (syz.0.190): by fd#3 tty tty1: SAK: killed process 6854 (syz.0.198): by fd#3 tty tty1: SAK: killed process 6855 (syz.0.198): by fd#3 tty tty1: SAK: killed process 6862 (syz.0.202): by fd#3 tty tty1: SAK: killed process 6863 (syz.0.202): by fd#3 tty tty1: SAK: killed process 6880 (syz.0.211): by fd#3 tty tty1: SAK: killed process 6881 (syz.0.211): by fd#3 tty tty1: SAK: killed process 6886 (syz.0.214): by fd#3 tty tty1: SAK: killed process 6887 (syz.0.214): by fd#3 tty tty1: SAK: killed process 6890 (syz.0.216): by fd#3 tty tty1: SAK: killed process 6891 (syz.0.216): by fd#3 tty tty1: SAK: killed process 6896 (syz.0.219): by fd#3 tty tty1: SAK: killed process 6897 (syz.0.219): by fd#3 tty tty1: SAK: killed process 6920 (syz.0.231): by fd#3 tty tty1: SAK: killed process 6921 (syz.0.231): by fd#3 tty tty1: SAK: killed process 6922 (syz.0.232): by fd#3 tty tty1: SAK: killed process 6923 (syz.0.232): by fd#3 tty tty1: SAK: killed process 6924 (syz.0.233): by fd#3 tty tty1: SAK: killed process 6925 (syz.0.233): by fd#3 tty tty1: SAK: killed process 6928 (syz.0.235): by fd#3 tty tty1: SAK: killed process 6929 (syz.0.235): by fd#3 tty tty1: SAK: killed process 6934 (syz.0.238): by fd#3 tty tty1: SAK: killed process 6935 (syz.0.238): by fd#3 tty tty1: SAK: killed process 6942 (syz.0.242): by fd#3 tty tty1: SAK: killed process 6943 (syz.0.242): by fd#3 tty tty1: SAK: killed process 6946 (syz.0.244): by fd#3 tty tty1: SAK: killed process 6947 (syz.0.244): by fd#3 tty tty1: SAK: killed process 6964 (syz.0.253): by fd#3 tty tty1: SAK: killed process 6965 (syz.0.253): by fd#3 tty tty1: SAK: killed process 6966 (syz.0.254): by fd#3 tty tty1: SAK: killed process 6967 (syz.0.254): by fd#3 tty tty1: SAK: killed process 6968 (syz.0.255): by fd#3 tty tty1: SAK: killed process 6969 (syz.0.255): by fd#3 tty tty1: SAK: killed process 6978 (syz.0.260): by fd#3 tty tty1: SAK: killed process 6979 (syz.0.260): by fd#3 tty tty1: SAK: killed process 6986 (syz.0.264): by fd#3 tty tty1: SAK: killed process 6987 (syz.0.264): by fd#3 tty tty1: SAK: killed process 6994 (syz.0.268): by fd#3 tty tty1: SAK: killed process 6995 (syz.0.268): by fd#3 tty tty1: SAK: killed process 7008 (syz.0.275): by fd#3 tty tty1: SAK: killed process 7009 (syz.0.275): by fd#3 tty tty1: SAK: killed process 7014 (syz.0.278): by fd#3 tty tty1: SAK: killed process 7015 (syz.0.278): by fd#3 tty tty1: SAK: killed process 7034 (syz.0.288): by fd#3 tty tty1: SAK: killed process 7035 (syz.0.288): by fd#3 tty tty1: SAK: killed process 7042 (syz.0.292): by fd#3 tty tty1: SAK: killed process 7043 (syz.0.292): by fd#3 tty tty1: SAK: killed process 7060 (syz.0.301): by fd#3 tty tty1: SAK: killed process 7061 (syz.0.301): by fd#3 tty tty1: SAK: killed process 7062 (syz.0.302): by fd#3 tty tty1: SAK: killed process 7063 (syz.0.302): by fd#3 tty tty1: SAK: killed process 7066 (syz.0.304): by fd#3 tty tty1: SAK: killed process 7067 (syz.0.304): by fd#3 tty tty1: SAK: killed process 7084 (syz.0.313): by fd#3 tty tty1: SAK: killed process 7085 (syz.0.313): by fd#3 tty tty1: SAK: killed process 7094 (syz.0.318): by fd#3 tty tty1: SAK: killed process 7095 (syz.0.318): by fd#3 tty tty1: SAK: killed process 7114 (syz.0.328): by fd#3 tty tty1: SAK: killed process 7115 (syz.0.328): by fd#3 tty tty1: SAK: killed process 7120 (syz.0.331): by fd#3 tty tty1: SAK: killed process 7121 (syz.0.331): by fd#3 tty tty1: SAK: killed process 7148 (syz.0.345): by fd#3 tty tty1: SAK: killed process 7149 (syz.0.345): by fd#3 tty tty1: SAK: killed process 7150 (syz.0.346): by fd#3 tty tty1: SAK: killed process 7151 (syz.0.346): by fd#3 tty tty1: SAK: killed process 7152 (syz.0.347): by fd#3 tty tty1: SAK: killed process 7153 (syz.0.347): by fd#3 tty tty1: SAK: killed process 7174 (syz.0.358): by fd#3 tty tty1: SAK: killed process 7175 (syz.0.358): by fd#3 tty tty1: SAK: killed process 7262 (syz.0.402): by fd#3 tty tty1: SAK: killed process 7263 (syz.0.402): by fd#3 tty tty1: SAK: killed process 7268 (syz.0.405): by fd#3 tty tty1: SAK: killed process 7269 (syz.0.405): by fd#3 tty tty1: SAK: killed process 7274 (syz.0.408): by fd#3 tty tty1: SAK: killed process 7275 (syz.0.408): by fd#3 tty tty1: SAK: killed process 7280 (syz.0.411): by fd#3 tty tty1: SAK: killed process 7281 (syz.0.411): by fd#3 tty tty1: SAK: killed process 7290 (syz.0.416): by fd#3 tty tty1: SAK: killed process 7291 (syz.0.416): by fd#3 tty tty1: SAK: killed process 7312 (syz.0.427): by fd#3 tty tty1: SAK: killed process 7313 (syz.0.427): by fd#3 tty tty1: SAK: killed process 7316 (syz.0.429): by fd#3 tty tty1: SAK: killed process 7332 (syz.0.437): by fd#3 tty tty1: SAK: killed process 7333 (syz.0.437): by fd#3 tty tty1: SAK: killed process 7338 (syz.0.440): by fd#3 tty tty1: SAK: killed process 7339 (syz.0.440): by fd#3 tty tty1: SAK: killed process 7348 (syz.0.445): by fd#3 tty tty1: SAK: killed process 7349 (syz.0.445): by fd#3 tty tty1: SAK: killed process 7358 (syz.0.450): by fd#3 tty tty1: SAK: killed process 7359 (syz.0.450): by fd#3