------------[ cut here ]------------
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0 Not tainted
------------------------------------------------------
kworker/0:8/5184 is trying to acquire lock:
ffffffff8e328140 (console_owner){-...}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1994 [inline]
ffffffff8e328140 (console_owner){-...}-{0:0}, at: vprintk_emit+0x3cf/0x770 kernel/printk/printk.c:2344

but task is already holding lock:
ffffffff94ad1d18 (&port_lock_key){-.-.}-{2:2}, at: uart_port_lock_irqsave include/linux/serial_core.h:618 [inline]
ffffffff94ad1d18 (&port_lock_key){-.-.}-{2:2}, at: uart_write+0x10e/0x320 drivers/tty/serial/serial_core.c:624

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&port_lock_key){-.-.}-{2:2}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
       uart_port_lock_irqsave include/linux/serial_core.h:618 [inline]
       serial8250_console_write+0x1a8/0x1770 drivers/tty/serial/8250/8250_port.c:3352
       console_emit_next_record kernel/printk/printk.c:2928 [inline]
       console_flush_all+0x867/0xfd0 kernel/printk/printk.c:2994
       console_unlock+0x13b/0x4d0 kernel/printk/printk.c:3063
       vprintk_emit+0x5a6/0x770 kernel/printk/printk.c:2345
       _printk+0xd5/0x120 kernel/printk/printk.c:2370
       register_console+0x722/0xce0 kernel/printk/printk.c:3596
       univ8250_console_init+0x49/0x50 drivers/tty/serial/8250/8250_core.c:719
       console_init+0x1b8/0x6f0 kernel/printk/printk.c:3742
       start_kernel+0x2d3/0x500 init/main.c:1038
       x86_64_start_reservations+0x2a/0x30 arch/x86/kernel/head64.c:507
       x86_64_start_kernel+0x99/0xa0 arch/x86/kernel/head64.c:488
       common_startup_64+0x13e/0x147

-> #0 (console_owner){-...}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       console_trylock_spinning kernel/printk/printk.c:1994 [inline]
       vprintk_emit+0x3ec/0x770 kernel/printk/printk.c:2344
       _printk+0xd5/0x120 kernel/printk/printk.c:2370
       __report_bug lib/bug.c:195 [inline]
       report_bug+0x346/0x500 lib/bug.c:219
       handle_bug+0x3e/0x70 arch/x86/kernel/traps.c:239
       exc_invalid_op+0x1a/0x50 arch/x86/kernel/traps.c:260
       asm_exc_invalid_op+0x1a/0x20 arch/x86/include/asm/idtentry.h:621
       uart_write+0x2b0/0x320 drivers/tty/serial/serial_core.c:625
       n_hdlc_send_frames+0x356/0xa90 drivers/tty/n_hdlc.c:288
       process_one_work kernel/workqueue.c:3231 [inline]
       process_scheduled_works+0xa2e/0x1830 kernel/workqueue.c:3312
       worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
       kthread+0x2f2/0x390 kernel/kthread.c:389
       ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&port_lock_key);
                               lock(console_owner);
                               lock(&port_lock_key);
  lock(console_owner);

 *** DEADLOCK ***

3 locks held by kworker/0:8/5184:
 #0: ffff888015078948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
 #0: ffff888015078948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
 #1: ffffc90002f9fd00 ((work_completion)(&n_hdlc->write_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
 #1: ffffc90002f9fd00 ((work_completion)(&n_hdlc->write_work)){+.+.}-{0:0}, at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
 #2: ffffffff94ad1d18 (&port_lock_key){-.-.}-{2:2}, at: uart_port_lock_irqsave include/linux/serial_core.h:618 [inline]
 #2: ffffffff94ad1d18 (&port_lock_key){-.-.}-{2:2}, at: uart_write+0x10e/0x320 drivers/tty/serial/serial_core.c:624

stack backtrace:
CPU: 0 PID: 5184 Comm: kworker/0:8 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: events n_hdlc_tty_write_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 console_trylock_spinning kernel/printk/printk.c:1994 [inline]
 vprintk_emit+0x3ec/0x770 kernel/printk/printk.c:2344
 _printk+0xd5/0x120 kernel/printk/printk.c:2370
 __report_bug lib/bug.c:195 [inline]
 report_bug+0x346/0x500 lib/bug.c:219
 handle_bug+0x3e/0x70 arch/x86/kernel/traps.c:239
 exc_invalid_op+0x1a/0x50 arch/x86/kernel/traps.c:260
 asm_exc_invalid_op+0x1a/0x20 arch/x86/include/asm/idtentry.h:621
RIP: 0010:uart_write+0x2b0/0x320 drivers/tty/serial/serial_core.c:625
Code: 74 08 48 89 df e8 90 b5 c1 fc 48 83 3b 00 74 74 e8 15 f1 5b fc eb 97 e8 0e f1 5b fc 45 31 e4 eb 08 e8 04 f1 5b fc 45 31 ed 90 <0f> 0b 90 45 84 e4 74 0a e8 f3 f0 5b fc 45 31 f6 eb 84 e8 e9 f0 5b
RSP: 0018:ffffc90002f9fac0 EFLAGS: 00010046
RAX: ffffffff853a35f2 RBX: dffffc0000000000 RCX: ffff88802b800000
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffc90002f9f9a0
RBP: ffff88801fab0f48 R08: 0000000000000003 R09: fffff520005f3f34
R10: dffffc0000000000 R11: fffff520005f3f34 R12: 0000000000000000
R13: 0000000000000246 R14: ffff88801fab0be8 R15: ffffffff94ad1d00
 n_hdlc_send_frames+0x356/0xa90 drivers/tty/n_hdlc.c:288
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2e/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
 kthread+0x2f2/0x390 kernel/kthread.c:389
 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
WARNING: CPU: 0 PID: 5184 at drivers/tty/serial/serial_core.c:625 uart_write+0x2b0/0x320 drivers/tty/serial/serial_core.c:625
Modules linked in:
CPU: 0 PID: 5184 Comm: kworker/0:8 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: events n_hdlc_tty_write_work
RIP: 0010:uart_write+0x2b0/0x320 drivers/tty/serial/serial_core.c:625
Code: 74 08 48 89 df e8 90 b5 c1 fc 48 83 3b 00 74 74 e8 15 f1 5b fc eb 97 e8 0e f1 5b fc 45 31 e4 eb 08 e8 04 f1 5b fc 45 31 ed 90 <0f> 0b 90 45 84 e4 74 0a e8 f3 f0 5b fc 45 31 f6 eb 84 e8 e9 f0 5b
RSP: 0018:ffffc90002f9fac0 EFLAGS: 00010046
RAX: ffffffff853a35f2 RBX: dffffc0000000000 RCX: ffff88802b800000
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffc90002f9f9a0
RBP: ffff88801fab0f48 R08: 0000000000000003 R09: fffff520005f3f34
R10: dffffc0000000000 R11: fffff520005f3f34 R12: 0000000000000000
R13: 0000000000000246 R14: ffff88801fab0be8 R15: ffffffff94ad1d00
FS:  0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b33528000 CR3: 000000001f9e2000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 n_hdlc_send_frames+0x356/0xa90 drivers/tty/n_hdlc.c:288
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2e/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
 kthread+0x2f2/0x390 kernel/kthread.c:389
 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>