possible deadlock in tty_buffer_flush

Status: upstream: reported on 2026/08/05 01:48
Reported-by: syzbot+52f1e976669d2ac314b1@syzkaller.appspotmail.com
First crash: 60d, last: 15d
▶ ▼ Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 possible deadlock in tty_buffer_flush (2) 4 2 60d 60d 0/2 upstream: reported on 2026/08/04 22:38
upstream possible deadlock in tty_buffer_flush serial 4 1 1898d 1894d 0/29 auto-closed as invalid on 2021/11/21 00:33
upstream possible deadlock in tty_buffer_flush (2) serial 4 7 1767d 1768d 0/29 auto-closed as invalid on 2022/03/31 16:04
upstream possible deadlock in tty_buffer_flush (3) serial 4 syz, C done 196 6d10h 755d 0/29 upstream: reported C repro on 2024/09/09 04:46
linux-6.6 possible deadlock in tty_buffer_flush 4 1 161d 161d 0/2 auto-obsoleted due to no activity on 2026/08/03 08:08

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kworker/1:15/5185 is trying to acquire lock:
ffff8880176280b8 (&buf->lock){+.+.}-{3:3}, at: tty_buffer_flush+0x78/0x3e0 drivers/tty/tty_buffer.c:230

but task is already holding lock:
ffffffff8cb21aa0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x24/0x210 drivers/tty/vt/vt_ioctl.c:987

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (console_lock){+.+.}-{0:0}:
       console_lock+0x160/0x1c0 kernel/printk/printk.c:2629
       do_con_write+0xfb/0x6c40 drivers/tty/vt/vt.c:2908
       con_write+0x1f/0x40 drivers/tty/vt/vt.c:3295
       tty_send_xchar+0x2aa/0x460 drivers/tty/tty_io.c:1162
       tty_ioctl+0x878/0xba0 drivers/tty/tty_io.c:2785
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&tty->termios_rwsem){++++}-{3:3}:
       down_read+0x42/0x2d0 kernel/locking/rwsem.c:1520
       n_tty_receive_buf_common+0x79/0x1470 drivers/tty/n_tty.c:1684
       tiocsti+0x1ea/0x270 drivers/tty/tty_io.c:2288
       tty_ioctl+0x34e/0xba0 drivers/tty/tty_io.c:2690
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&buf->lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain kernel/locking/lockdep.c:3830 [inline]
       __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
       lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5678
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
       tty_buffer_flush+0x78/0x3e0 drivers/tty/tty_buffer.c:230
       tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:389
       __do_SAK+0x25c/0x630 drivers/tty/tty_io.c:3011
       vc_SAK+0x74/0x210 drivers/tty/vt/vt_ioctl.c:997
       process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
       worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
       kthread+0x29d/0x330 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

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:15/5185:
 #0: ffff888017470938 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x7b4/0x1160 kernel/workqueue.c:2267
 #1: ffffc90005837d00 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work+0x7b4/0x1160 kernel/workqueue.c:2267
 #2: ffffffff8cb21aa0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x24/0x210 drivers/tty/vt/vt_ioctl.c:987
 #3: ffff888059fc1098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:264 [inline]
 #3: ffff888059fc1098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x1c/0xc0 drivers/tty/tty_ldisc.c:387

stack backtrace:
CPU: 1 PID: 5185 Comm: kworker/1:15 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Workqueue: events vc_SAK
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain kernel/locking/lockdep.c:3830 [inline]
 __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
 lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5678
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
 tty_buffer_flush+0x78/0x3e0 drivers/tty/tty_buffer.c:230
 tty_ldisc_flush+0x6a/0xc0 drivers/tty/tty_ldisc.c:389
 __do_SAK+0x25c/0x630 drivers/tty/tty_io.c:3011
 vc_SAK+0x74/0x210 drivers/tty/vt/vt_ioctl.c:997
 process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>
tty tty1: SAK: killed process 5478 (syz.5.397): by fd#3
tty tty1: SAK: killed process 5481 (syz.5.397): by fd#3
tty tty1: SAK: killed process 5483 (syz.5.397): by fd#3

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/09/18 07:51 linux-6.1.y 1a8763b93150 853b104b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in tty_buffer_flush
2026/08/05 01:47 linux-6.1.y fb28aa725e05 d4abbeac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in tty_buffer_flush
2026/08/11 19:39 linux-6.1.y e4f7d8be268e 71790083 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in tty_buffer_flush
2026/08/11 01:24 linux-6.1.y e4f7d8be268e 508909ea .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in tty_buffer_flush
* Struck through repros no longer work on HEAD.