======================================================
WARNING: possible circular locking dependency detected
4.14.292-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/10080 is trying to acquire lock:
 (&(&gsm->tx_lock)->rlock){-...}, at: [<ffffffff8356eece>] gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490

but task is already holding lock:
 (&port_lock_key){-.-.}, at: [<ffffffff835c4660>] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&port_lock_key){-.-.}:
       __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_room+0xd5/0x340 drivers/tty/serial/serial_core.c:643
       tty_write_room+0x61/0x80 drivers/tty/tty_ioctl.c:78
       gsmld_write+0x69/0x120 drivers/tty/n_gsm.c:2546
       do_tty_write drivers/tty/tty_io.c:959 [inline]
       tty_write+0x410/0x740 drivers/tty/tty_io.c:1043
       __vfs_write+0xe4/0x630 fs/read_write.c:480
       __kernel_write+0xf5/0x330 fs/read_write.c:501
       write_pipe_buf+0x143/0x1c0 fs/splice.c:797
       splice_from_pipe_feed fs/splice.c:502 [inline]
       __splice_from_pipe+0x326/0x7a0 fs/splice.c:626
       splice_from_pipe fs/splice.c:661 [inline]
       default_file_splice_write+0xc5/0x150 fs/splice.c:809
       do_splice_from fs/splice.c:851 [inline]
       direct_splice_actor+0x115/0x160 fs/splice.c:1016
       splice_direct_to_actor+0x25a/0x700 fs/splice.c:971
       do_splice_direct+0x164/0x210 fs/splice.c:1059
       do_sendfile+0x47f/0xb30 fs/read_write.c:1441
       SYSC_sendfile64 fs/read_write.c:1502 [inline]
       SyS_sendfile64+0xff/0x110 fs/read_write.c:1488
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (&(&gsm->tx_lock)->rlock){-...}:
       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
       gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490
       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
       ret_from_intr+0x0/0x1e
       arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
       __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
       _raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:192
       __balance_callback kernel/sched/core.c:2724 [inline]
       balance_callback kernel/sched/core.c:2730 [inline]
       __schedule+0x14f5/0x1de0 kernel/sched/core.c:3393
       preempt_schedule_irq+0xb0/0x140 kernel/sched/core.c:3614
       retint_kernel+0x1b/0x2d
       lock_is_held_type+0x11/0x210 kernel/locking/lockdep.c:4025
       lock_is_held include/linux/lockdep.h:437 [inline]
       ___might_sleep+0x1ea/0x2b0 kernel/sched/core.c:6006
       clear_huge_page+0xc4/0x7b0 mm/memory.c:4747
       do_huge_pmd_wp_page+0x1544/0x4730 mm/huge_memory.c:1323
       wp_huge_pmd mm/memory.c:4011 [inline]
       __handle_mm_fault+0x20b2/0x4620 mm/memory.c:4224
       handle_mm_fault+0x455/0x9c0 mm/memory.c:4271
       __do_page_fault+0x549/0xad0 arch/x86/mm/fault.c:1442
       page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1123
       copy_user_enhanced_fast_string+0xe/0x20 arch/x86/lib/copy_user_64.S:180
       copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
       raw_copy_to_user arch/x86/include/asm/uaccess_64.h:112 [inline]
       copyout+0x99/0xc0 lib/iov_iter.c:137
       copy_page_to_iter_iovec lib/iov_iter.c:206 [inline]
       copy_page_to_iter+0x324/0xcd0 lib/iov_iter.c:725
       skb_copy_datagram_iter+0x33b/0x910 net/core/datagram.c:452
       skb_copy_datagram_msg include/linux/skbuff.h:3346 [inline]
       tcp_recvmsg+0x860/0x1d50 net/ipv4/tcp.c:1962
       inet_recvmsg+0xef/0x4d0 net/ipv4/af_inet.c:793
       sock_recvmsg_nosec net/socket.c:819 [inline]
       sock_recvmsg net/socket.c:826 [inline]
       sock_recvmsg net/socket.c:822 [inline]
       SYSC_recvfrom net/socket.c:1815 [inline]
       SyS_recvfrom+0x21b/0x340 net/socket.c:1787
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&port_lock_key);
                               lock(&(&gsm->tx_lock)->rlock);
                               lock(&port_lock_key);
  lock(&(&gsm->tx_lock)->rlock);

 *** DEADLOCK ***

5 locks held by syz-executor.3/10080:
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85be159c>] lock_sock include/net/sock.h:1473 [inline]
 #0:  (sk_lock-AF_INET){+.+.}, at: [<ffffffff85be159c>] sk_wait_data+0x1cc/0x3d0 net/core/sock.c:2326
 #1:  (&mm->mmap_sem){++++}, at: [<ffffffff812413a9>] __do_page_fault+0x2b9/0xad0 arch/x86/mm/fault.c:1371
 #2:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff835b19ea>] spin_lock include/linux/spinlock.h:317 [inline]
 #2:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff835b19ea>] serial8250_interrupt+0x3a/0x210 drivers/tty/serial/8250/8250_core.c:119
 #3:  (&port_lock_key){-.-.}, at: [<ffffffff835c4660>] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891
 #4:  (&tty->ldisc_sem){++++}, at: [<ffffffff83556cfb>] tty_ldisc_ref+0x1b/0x80 drivers/tty/tty_ldisc.c:305

stack backtrace:
CPU: 1 PID: 10080 Comm: syz-executor.3 Not tainted 4.14.292-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 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
 gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490
 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
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:192
RSP: 0018:ffff888054dff368 EFLAGS: 00000286 ORIG_RAX: ffffffffffffffc8
RAX: 1ffffffff11e1359 RBX: 0000000000000286 RCX: 1ffff11013a5419a
RDX: dffffc0000000000 RSI: ffff88809d2a0cb0 RDI: 0000000000000286
RBP: ffff8880ba534400 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
R13: 0000000000000286 R14: 0000000000000000 R15: ffff8880ba534400
 __balance_callback kernel/sched/core.c:2724 [inline]
 balance_callback kernel/sched/core.c:2730 [inline]
 __schedule+0x14f5/0x1de0 kernel/sched/core.c:3393
 preempt_schedule_irq+0xb0/0x140 kernel/sched/core.c:3614
 retint_kernel+0x1b/0x2d
RIP: 0010:get_current arch/x86/include/asm/current.h:15 [inline]
RIP: 0010:lock_is_held_type+0x11/0x210 kernel/locking/lockdep.c:4029
RSP: 0018:ffff888054dff510 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff02
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffffffff88f781c0
RBP: ffffffff88f781c0 R08: 0000000000000000 R09: 0000000000000002
R10: 0000000000000000 R11: ffff88809d2a0400 R12: 000000000000128b
R13: ffffea0001500000 R14: 0000000000000000 R15: dffffc0000000000
 lock_is_held include/linux/lockdep.h:437 [inline]
 ___might_sleep+0x1ea/0x2b0 kernel/sched/core.c:6006
 clear_huge_page+0xc4/0x7b0 mm/memory.c:4747
 do_huge_pmd_wp_page+0x1544/0x4730 mm/huge_memory.c:1323
 wp_huge_pmd mm/memory.c:4011 [inline]
 __handle_mm_fault+0x20b2/0x4620 mm/memory.c:4224
 handle_mm_fault+0x455/0x9c0 mm/memory.c:4271
 __do_page_fault+0x549/0xad0 arch/x86/mm/fault.c:1442
 page_fault+0x25/0x50 arch/x86/entry/entry_64.S:1123
RIP: 0010:copy_user_enhanced_fast_string+0xe/0x20 arch/x86/lib/copy_user_64.S:181
RSP: 0018:ffff888054dff9e8 EFLAGS: 00050206
RAX: ffffed100a984e2d RBX: 0000000000007164 RCX: 0000000000004620
RDX: 0000000000007164 RSI: ffff888054c22b44 RDI: 0000000020600000
RBP: 00000000205fd4bc R08: 0000000000000000 R09: ffffed100a984e2c
R10: ffff888054c27163 R11: 0000000000000000 R12: ffff888054c20000
R13: 00007ffffffff000 R14: 0000000020604620 R15: ffff888054dffd88
 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
 raw_copy_to_user arch/x86/include/asm/uaccess_64.h:112 [inline]
 copyout+0x99/0xc0 lib/iov_iter.c:137
 copy_page_to_iter_iovec lib/iov_iter.c:206 [inline]
 copy_page_to_iter+0x324/0xcd0 lib/iov_iter.c:725
 skb_copy_datagram_iter+0x33b/0x910 net/core/datagram.c:452
 skb_copy_datagram_msg include/linux/skbuff.h:3346 [inline]
 tcp_recvmsg+0x860/0x1d50 net/ipv4/tcp.c:1962
 inet_recvmsg+0xef/0x4d0 net/ipv4/af_inet.c:793
 sock_recvmsg_nosec net/socket.c:819 [inline]
 sock_recvmsg net/socket.c:826 [inline]
 sock_recvmsg net/socket.c:822 [inline]
 SYSC_recvfrom net/socket.c:1815 [inline]
 SyS_recvfrom+0x21b/0x340 net/socket.c:1787
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7fc1cd5903c9
RSP: 002b:00007fc1cbea2168 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: ffffffffffffffda RBX: 00007fc1cd6a31f0 RCX: 00007fc1cd5903c9
RDX: 00000000fffffe32 RSI: 0000000020000480 RDI: 0000000000000005
RBP: 00007fc1cd5eb33f R08: 0000000000000000 R09: fffffffffffffecb
R10: 0000000000000700 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff8c24dbff R14: 00007fc1cbea2300 R15: 0000000000022000
print_req_error: I/O error, dev loop3, sector 0
print_req_error: I/O error, dev loop3, sector 0
print_req_error: I/O error, dev loop3, sector 0
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
batman_adv: batadv0: Interface deactivated: batadv_slave_1
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
batman_adv: batadv0: Removing interface: batadv_slave_1
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
9pnet: Could not find request transport: xen
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
9pnet: Could not find request transport: xen
9pnet: Could not find request transport: xen
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
mmap: syz-executor.0 (10824) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.
9pnet: Could not find request transport: xen
9pnet: Could not find request transport: xen
9pnet: Could not find request transport: xen
overlayfs: fs on 'file0' does not support file handles, falling back to index=off.
overlayfs: fs on './file0' does not support file handles, falling back to index=off.
9pnet: Could not find request transport: xen
usb usb2: usbfs: process 11006 (syz-executor.2) did not claim interface 0 before use
xt_TCPMSS: Only works on TCP SYN packets
kauditd_printk_skb: 4 callbacks suppressed
audit: type=1800 audit(1662732809.553:16): pid=11088 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed" comm="syz-executor.0" name="SYSV00000000" dev="hugetlbfs" ino=0 res=0
audit: type=1800 audit(1662732809.583:17): pid=11092 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed" comm="syz-executor.0" name="SYSV00000000" dev="hugetlbfs" ino=98306 res=0