rfcomm rfcomm0: tty_port_close_start: tty->count = 1 port count = 0 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.76/4692 is trying to acquire lock: ffffffff8db21a80 (console_owner){..-.}-{0:0}, at: console_lock_spinning_enable kernel/printk/printk.c:1818 [inline] ffffffff8db21a80 (console_owner){..-.}-{0:0}, at: console_emit_next_record+0x68f/0xb50 kernel/printk/printk.c:2774 but task is already holding lock: ffff888079434158 (&port->lock){-.-.}-{2:2}, at: tty_port_close_start+0x5a/0x550 drivers/tty/tty_port.c:632 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&port->lock){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb0/0x100 kernel/locking/spinlock.c:162 tty_port_tty_get drivers/tty/tty_port.c:327 [inline] tty_port_default_wakeup+0x1d/0xf0 drivers/tty/tty_port.c:68 serial8250_tx_chars+0x615/0x800 drivers/tty/serial/8250/8250_port.c:1854 serial8250_handle_irq+0x6b0/0x8b0 drivers/tty/serial/8250/8250_port.c:1968 serial8250_default_handle_irq+0xb4/0x1a0 drivers/tty/serial/8250/8250_port.c:1988 serial8250_interrupt+0x9b/0x1c0 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x293/0xa50 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:193 [inline] handle_irq_event+0x87/0x1e0 kernel/irq/handle.c:210 handle_edge_irq+0x242/0xb20 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:233 [inline] __common_interrupt+0xd7/0x1e0 arch/x86/kernel/irq.c:252 common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:242 asm_common_interrupt+0x22/0x40 arch/x86/include/asm/idtentry.h:682 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] _raw_spin_unlock_irqrestore+0xbc/0x120 kernel/locking/spinlock.c:194 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] uart_write+0x67a/0x900 drivers/tty/serial/serial_core.c:601 process_output_block drivers/tty/n_tty.c:586 [inline] n_tty_write+0xd61/0x11e0 drivers/tty/n_tty.c:2377 do_tty_write drivers/tty/tty_io.c:1018 [inline] file_tty_write+0x4c7/0x840 drivers/tty/tty_io.c:1089 call_write_iter include/linux/fs.h:2271 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x482/0x9a0 fs/read_write.c:584 ksys_write+0x14d/0x260 fs/read_write.c:637 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 (&port_lock_key){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb0/0x100 kernel/locking/spinlock.c:162 serial8250_console_write+0x17d/0x18b0 drivers/tty/serial/8250/8250_port.c:3445 call_console_driver kernel/printk/printk.c:1977 [inline] console_emit_next_record+0x795/0xb50 kernel/printk/printk.c:2777 console_flush_all kernel/printk/printk.c:-1 [inline] console_unlock+0x223/0x630 kernel/printk/printk.c:2906 vprintk_emit+0x4b3/0x6a0 kernel/printk/printk.c:2303 _printk+0xda/0x130 kernel/printk/printk.c:2328 register_console+0x6bd/0x9b0 kernel/printk/printk.c:3269 univ8250_console_init+0x41/0x43 drivers/tty/serial/8250/8250_core.c:687 console_init+0x1bc/0x78e kernel/printk/printk.c:3359 start_kernel+0x2f3/0x50d init/main.c:1049 secondary_startup_64_no_verify+0xcf/0xdb -> #0 (console_owner){..-.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3162 [inline] check_prevs_add kernel/locking/lockdep.c:3281 [inline] validate_chain kernel/locking/lockdep.c:3897 [inline] __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790 console_lock_spinning_enable kernel/printk/printk.c:1818 [inline] console_emit_next_record+0x6b0/0xb50 kernel/printk/printk.c:2774 console_flush_all kernel/printk/printk.c:-1 [inline] console_unlock+0x223/0x630 kernel/printk/printk.c:2906 vprintk_emit+0x4b3/0x6a0 kernel/printk/printk.c:2303 _printk+0xda/0x130 kernel/printk/printk.c:2328 tty_port_close_start+0x3a9/0x550 drivers/tty/tty_port.c:634 tty_port_close+0x26/0x140 drivers/tty/tty_port.c:717 tty_release+0x32c/0x14f0 drivers/tty/tty_io.c:1753 __fput+0x20a/0x8b0 fs/file_table.c:320 task_work_run+0x1d0/0x260 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Chain exists of: console_owner --> &port_lock_key --> &port->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port->lock); lock(&port_lock_key); lock(&port->lock); lock(console_owner); *** DEADLOCK *** 3 locks held by syz.0.76/4692: #0: ffff8880730ae1c0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_release+0x6e/0x14f0 drivers/tty/tty_io.c:1735 #1: ffff888079434158 (&port->lock){-.-.}-{2:2}, at: tty_port_close_start+0x5a/0x550 drivers/tty/tty_port.c:632 #2: ffffffff8db21b60 (console_lock){+.+.}-{0:0}, at: _printk+0xda/0x130 kernel/printk/printk.c:2328 stack backtrace: CPU: 1 PID: 4692 Comm: syz.0.76 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/07/2026 Call Trace: dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2215 check_prev_add kernel/locking/lockdep.c:3162 [inline] check_prevs_add kernel/locking/lockdep.c:3281 [inline] validate_chain kernel/locking/lockdep.c:3897 [inline] __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790 console_lock_spinning_enable kernel/printk/printk.c:1818 [inline] console_emit_next_record+0x6b0/0xb50 kernel/printk/printk.c:2774 console_flush_all kernel/printk/printk.c:-1 [inline] console_unlock+0x223/0x630 kernel/printk/printk.c:2906 vprintk_emit+0x4b3/0x6a0 kernel/printk/printk.c:2303 _printk+0xda/0x130 kernel/printk/printk.c:2328 tty_port_close_start+0x3a9/0x550 drivers/tty/tty_port.c:634 tty_port_close+0x26/0x140 drivers/tty/tty_port.c:717 tty_release+0x32c/0x14f0 drivers/tty/tty_io.c:1753 __fput+0x20a/0x8b0 fs/file_table.c:320 task_work_run+0x1d0/0x260 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213 __syscall_exit_to_user_mode_work kernel/entry/common.c:295 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:306 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7facbff9f559 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffc9e081148 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007facc0227da0 RCX: 00007facbff9f559 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007facc0227da0 R08: 00007facc0226128 R09: 0000000000000000 R10: 00000000003fe350 R11: 0000000000000246 R12: 00000000000172f2 R13: 00007facc022609c R14: 0000000000017026 R15: 00007ffc9e081250