============================================ WARNING: possible recursive locking detected 4.14.295-syzkaller #0 Not tainted -------------------------------------------- syz-executor.4/12422 is trying to acquire lock: (&port_lock_key){-.-.}, at: [] uart_write+0x109/0x560 drivers/tty/serial/serial_core.c:611 but task is already holding lock: (&port_lock_key){-.-.}, at: [] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&port_lock_key); lock(&port_lock_key); *** DEADLOCK *** May be due to missing lock nesting notation 5 locks held by syz-executor.4/12422: #0: (rtnl_mutex){+.+.}, at: [] __tun_chr_ioctl.isra.0+0x4f9/0x3440 drivers/net/tun.c:2379 #1: (kernfs_mutex){+.+.}, at: [] kernfs_add_one+0x4c/0x3a0 fs/kernfs/dir.c:760 #2: (&(&i->lock)->rlock){-.-.}, at: [] spin_lock include/linux/spinlock.h:317 [inline] #2: (&(&i->lock)->rlock){-.-.}, at: [] serial8250_interrupt+0x3a/0x210 drivers/tty/serial/8250/8250_core.c:119 #3: (&port_lock_key){-.-.}, at: [] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891 #4: (&tty->ldisc_sem){++++}, at: [] tty_ldisc_ref+0x1b/0x80 drivers/tty/tty_ldisc.c:305 stack backtrace: CPU: 1 PID: 12422 Comm: syz-executor.4 Not tainted 4.14.295-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_deadlock_bug kernel/locking/lockdep.c:1800 [inline] check_deadlock kernel/locking/lockdep.c:1847 [inline] validate_chain kernel/locking/lockdep.c:2448 [inline] __lock_acquire.cold+0x180/0x97c kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160 uart_write+0x109/0x560 drivers/tty/serial/serial_core.c:611 n_hdlc_send_frames+0x241/0x410 drivers/tty/n_hdlc.c:404 n_hdlc_tty_wakeup+0x95/0xb0 drivers/tty/n_hdlc.c:480 tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533 tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49 serial8250_tx_chars+0x3fe/0xc70 drivers/tty/serial/8250/8250_port.c:1828 serial8250_handle_irq.part.0+0x28d/0x330 drivers/tty/serial/8250/8250_port.c:1915 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1888 [inline] serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1931 serial8250_interrupt+0xf3/0x210 drivers/tty/serial/8250/8250_core.c:129 __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147 handle_irq_event_percpu kernel/irq/handle.c:187 [inline] handle_irq_event+0xed/0x240 kernel/irq/handle.c:204 handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230 common_interrupt+0x93/0x93 arch/x86/entry/entry_64.S:576 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline] RIP: 0010:lock_acquire+0x1ec/0x3f0 kernel/locking/lockdep.c:4001 RSP: 0018:ffff88804c957820 EFLAGS: 00000286 ORIG_RAX: ffffffffffffffc8 RAX: 1ffffffff11e1359 RBX: ffff88804b98e400 RCX: 0000000000005e2f RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286 RBP: ffffffff8904bac0 R08: ffffffff8b9d0c78 R09: 0000000000040059 R10: ffff88804b98ecb0 R11: ffff88804b98e400 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 kernfs_add_one+0x4c/0x3a0 fs/kernfs/dir.c:760 __kernfs_create_file+0x27a/0x320 fs/kernfs/file.c:1017 sysfs_add_file_mode_ns+0x1e1/0x450 fs/sysfs/file.c:308 sysfs_merge_group+0xdc/0x200 fs/sysfs/group.c:295 dpm_sysfs_add+0x122/0x1c0 drivers/base/power/sysfs.c:691 device_add+0x977/0x15c0 drivers/base/core.c:1908 netdev_register_kobject+0x181/0x410 net/core/net-sysfs.c:1627 register_netdevice+0x955/0xe50 net/core/dev.c:7668 __tun_chr_ioctl.isra.0+0x15b2/0x3440 drivers/net/tun.c:2141 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x7f3d7b9655a9 RSP: 002b:00007f3d7a2d9168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f3d7ba86f80 RCX: 00007f3d7b9655a9 RDX: 0000000020000040 RSI: 00000000400454ca RDI: 0000000000000004 RBP: 00007f3d7b9c0580 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd8288e0ff R14: 00007f3d7a2d9300 R15: 0000000000022000