FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0
======================================================
WARNING: possible circular locking dependency detected
5.15.0-rc1-syzkaller-00001-g64a19591a293 #0 Not tainted
------------------------------------------------------
syz-executor.1/3082 is trying to acquire lock:
ffffffff83c49da8 (console_owner){-...}-{0:0}, at: console_unlock+0x238/0x8d2 kernel/printk/printk.c:2706

but task is already holding lock:
ffffffe008199958 (&port->lock){-.-.}-{2:2}, at: pty_write+0xaa/0x114 drivers/tty/pty.c:120

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&port->lock){-.-.}-{2:2}:

-> #1 (&port_lock_key){-.-.}-{2:2}:

-> #0 (console_owner){-...}-{0:0}:

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 ***

6 locks held by syz-executor.1/3082:
 #0: ffffffe00dd73098 (&tty->ldisc_sem){++++}-{0:0}, at: ldsem_down_read+0x3c/0x48 drivers/tty/tty_ldsem.c:340
 #1: ffffffe00dd73130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock drivers/tty/tty_io.c:961 [inline]
 #1: ffffffe00dd73130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: do_tty_write drivers/tty/tty_io.c:984 [inline]
 #1: ffffffe00dd73130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write.constprop.0+0x17e/0x5ac drivers/tty/tty_io.c:1110
 #2: ffffffe00dd732e8 (&tty->termios_rwsem){++++}-{3:3}, at: n_tty_write+0xf0/0xa36 drivers/tty/n_tty.c:2271
 #3: ffffffd016655378 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0x818/0xa36 drivers/tty/n_tty.c:2310
 #4: ffffffe008199958 (&port->lock){-.-.}-{2:2}, at: pty_write+0xaa/0x114 drivers/tty/pty.c:120
 #5: ffffffff83c49c28 (console_lock){+.+.}-{0:0}, at: vprintk_default+0x22/0x2e kernel/printk/printk.c:2255

stack backtrace:
CPU: 1 PID: 3082 Comm: syz-executor.1 Not tainted 5.15.0-rc1-syzkaller-00001-g64a19591a293 #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff8000957e>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:112
CPU: 1 PID: 3082 Comm: syz-executor.1 Not tainted 5.15.0-rc1-syzkaller-00001-g64a19591a293 #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff8000957e>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:112