====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:7/4473 is trying to acquire lock: ffff88801bef42e8 (&tty->termios_rwsem){++++}-{3:3}, at: n_tty_flush_buffer+0x2c/0x1e0 drivers/tty/n_tty.c:369 but task is already holding lock: ffff88807e6cf0b8 (&buf->lock){+.+.}-{3:3}, at: tty_buffer_flush+0x78/0x370 drivers/tty/tty_buffer.c:230 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&buf->lock){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 tty_buffer_flush+0x78/0x370 drivers/tty/tty_buffer.c:230 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:400 __do_SAK+0x260/0x5f0 drivers/tty/tty_io.c:3051 vc_SAK+0x74/0x210 drivers/tty/vt/vt_ioctl.c:993 process_one_work+0x867/0xff0 kernel/workqueue.c:2310 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #2 (console_lock){+.+.}-{0:0}: console_lock+0x47/0x70 kernel/printk/printk.c:2557 uart_configure_port drivers/tty/serial/serial_core.c:2425 [inline] uart_add_one_port+0x826/0x1d10 drivers/tty/serial/serial_core.c:2980 serial8250_register_8250_port+0x137f/0x1a80 drivers/tty/serial/8250/8250_core.c:1094 serial_pnp_probe+0x569/0x740 drivers/tty/serial/8250/8250_pnp.c:482 pnp_device_probe+0x2bc/0x470 drivers/pnp/driver.c:111 call_driver_probe drivers/base/dd.c:-1 [inline] really_probe+0x276/0xc70 drivers/base/dd.c:595 __driver_probe_device+0x1f5/0x390 drivers/base/dd.c:775 driver_probe_device+0x4f/0x420 drivers/base/dd.c:805 __driver_attach+0x45d/0x660 drivers/base/dd.c:1184 bus_for_each_dev+0x182/0x1f0 drivers/base/bus.c:303 bus_add_driver+0x324/0x5d0 drivers/base/bus.c:620 driver_register+0x32d/0x430 drivers/base/driver.c:240 serial8250_init+0x96/0x170 drivers/tty/serial/8250/8250_core.c:1190 do_one_initcall+0x272/0x730 init/main.c:1315 do_initcall_level+0x13d/0x1f0 init/main.c:1388 do_initcalls+0x4b/0x90 init/main.c:1404 kernel_init_freeable+0x3d5/0x560 init/main.c:1628 kernel_init+0x19/0x1b0 init/main.c:1519 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #1 (&port->mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 uart_set_termios+0x80/0x900 drivers/tty/serial/serial_core.c:1522 tty_set_termios+0xc73/0x1770 drivers/tty/tty_ioctl.c:358 set_termios+0x6d3/0x8a0 drivers/tty/tty_ioctl.c:458 tty_mode_ioctl+0x686/0x890 drivers/tty/tty_ioctl.c:-1 tty_ioctl+0x8e3/0xc30 drivers/tty/tty_io.c:2819 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&tty->termios_rwsem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 down_write+0x38/0x60 kernel/locking/rwsem.c:1551 n_tty_flush_buffer+0x2c/0x1e0 drivers/tty/n_tty.c:369 tty_buffer_flush+0x2e4/0x370 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:400 __do_SAK+0x260/0x5f0 drivers/tty/tty_io.c:3051 vc_SAK+0x74/0x210 drivers/tty/vt/vt_ioctl.c:993 process_one_work+0x867/0xff0 kernel/workqueue.c:2310 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 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:7/4473: #0: ffff888016c70938 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x75c/0xff0 kernel/workqueue.c:-1 #1: ffffc90004b1fd00 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work+0x79e/0xff0 kernel/workqueue.c:2285 #2: ffffffff8c313aa0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x24/0x210 drivers/tty/vt/vt_ioctl.c:983 #3: ffff88801bef4098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:273 [inline] #3: ffff88801bef4098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x1c/0xc0 drivers/tty/tty_ldisc.c:398 #4: ffff88807e6cf0b8 (&buf->lock){+.+.}-{3:3}, at: tty_buffer_flush+0x78/0x370 drivers/tty/tty_buffer.c:230 stack backtrace: CPU: 0 PID: 4473 Comm: kworker/0:7 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Workqueue: events vc_SAK Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 down_write+0x38/0x60 kernel/locking/rwsem.c:1551 n_tty_flush_buffer+0x2c/0x1e0 drivers/tty/n_tty.c:369 tty_buffer_flush+0x2e4/0x370 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:400 __do_SAK+0x260/0x5f0 drivers/tty/tty_io.c:3051 vc_SAK+0x74/0x210 drivers/tty/vt/vt_ioctl.c:993 process_one_work+0x867/0xff0 kernel/workqueue.c:2310 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287