======================================================
WARNING: possible circular locking dependency detected
6.1.80-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/809 is trying to acquire lock:
ffff888021deef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
ffff888021deef70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_diag_get_aux+0x72f/0x830 net/ipv4/tcp_diag.c:137
but task is already holding lock:
ffffc900013345d8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffffc900013345d8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_diag_dump_icsk+0x32c/0x1520 net/ipv4/inet_diag.c:1038
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&h->lhash2[i].lock){+.+.}-{2:2}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:351 [inline]
__inet_hash+0x301/0xba0 net/ipv4/inet_hashtables.c:728
inet_csk_listen_start+0x22c/0x310 net/ipv4/inet_connection_sock.c:1264
inet_listen+0x2c7/0x7c0 net/ipv4/af_inet.c:228
mptcp_listen+0x1f1/0x3e0 net/mptcp/protocol.c:3817
__sys_listen+0x1a7/0x220 net/socket.c:1840
__do_sys_listen net/socket.c:1849 [inline]
__se_sys_listen net/socket.c:1847 [inline]
__x64_sys_listen+0x56/0x60 net/socket.c:1847
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #0 (k-sk_lock-AF_INET){+.+.}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
lock_sock_fast include/net/sock.h:1777 [inline]
subflow_get_info+0x162/0xd10 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x72f/0x830 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0x10ad/0x1db0 net/ipv4/inet_diag.c:345
inet_diag_dump_icsk+0x4ef/0x1520 net/ipv4/inet_diag.c:1061
__inet_diag_dump+0x20e/0x3a0 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x1bd/0x2d0 net/ipv4/inet_diag.c:1287
netlink_dump+0x603/0xc50 net/netlink/af_netlink.c:2231
__netlink_dump_start+0x541/0x6e0 net/netlink/af_netlink.c:2335
netlink_dump_start include/linux/netlink.h:269 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:277
netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2514
___sys_sendmsg net/socket.c:2568 [inline]
__sys_sendmsg+0x2a9/0x390 net/socket.c:2597
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&h->lhash2[i].lock);
lock(k-sk_lock-AF_INET);
lock(&h->lhash2[i].lock);
lock(k-sk_lock-AF_INET);
*** DEADLOCK ***
5 locks held by syz-executor.2/809:
#0: ffffffff8e29f948 (sock_diag_mutex){+.+.}-{3:3}, at: sock_diag_rcv+0x17/0x40 net/core/sock_diag.c:276
#1: ffffffff8e29f7a8 (sock_diag_table_mutex){+.+.}-{3:3}, at: sock_diag_rcv_msg+0xb8/0x400 net/core/sock_diag.c:256
#2: ffff888075ec2690 (nlk_cb_mutex-SOCK_DIAG){+.+.}-{3:3}, at: netlink_dump+0xce/0xc50 net/netlink/af_netlink.c:2178
#3: ffffffff8e37df08 (inet_diag_table_mutex){+.+.}-{3:3}, at: inet_diag_lock_handler net/ipv4/inet_diag.c:63 [inline]
#3: ffffffff8e37df08 (inet_diag_table_mutex){+.+.}-{3:3}, at: __inet_diag_dump+0x191/0x3a0 net/ipv4/inet_diag.c:1177
#4: ffffc900013345d8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
#4: ffffc900013345d8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_diag_dump_icsk+0x32c/0x1520 net/ipv4/inet_diag.c:1038
stack backtrace:
CPU: 0 PID: 809 Comm: syz-executor.2 Not tainted 6.1.80-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
lock_sock_fast include/net/sock.h:1777 [inline]
subflow_get_info+0x162/0xd10 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x72f/0x830 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0x10ad/0x1db0 net/ipv4/inet_diag.c:345
inet_diag_dump_icsk+0x4ef/0x1520 net/ipv4/inet_diag.c:1061
__inet_diag_dump+0x20e/0x3a0 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x1bd/0x2d0 net/ipv4/inet_diag.c:1287
netlink_dump+0x603/0xc50 net/netlink/af_netlink.c:2231
__netlink_dump_start+0x541/0x6e0 net/netlink/af_netlink.c:2335
netlink_dump_start include/linux/netlink.h:269 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:277
netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2514
___sys_sendmsg net/socket.c:2568 [inline]
__sys_sendmsg+0x2a9/0x390 net/socket.c:2597
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f105f27dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f105ff830c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f105f3abf80 RCX: 00007f105f27dda9
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f105f2ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f105f3abf80 R15: 00007ffe0143a318
BUG: sleeping function called from invalid context at net/core/sock.c:3516
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 809, name: syz-executor.2
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
INFO: lockdep is turned off.
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 809 Comm: syz-executor.2 Not tainted 6.1.80-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
__might_resched+0x5cb/0x780 kernel/sched/core.c:9942
__lock_sock_fast+0x2d/0xe0 net/core/sock.c:3516
lock_sock_fast include/net/sock.h:1779 [inline]
subflow_get_info+0x16e/0xd10 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x72f/0x830 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0x10ad/0x1db0 net/ipv4/inet_diag.c:345
inet_diag_dump_icsk+0x4ef/0x1520 net/ipv4/inet_diag.c:1061
__inet_diag_dump+0x20e/0x3a0 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x1bd/0x2d0 net/ipv4/inet_diag.c:1287
netlink_dump+0x603/0xc50 net/netlink/af_netlink.c:2231
__netlink_dump_start+0x541/0x6e0 net/netlink/af_netlink.c:2335
netlink_dump_start include/linux/netlink.h:269 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:277
netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2514
___sys_sendmsg net/socket.c:2568 [inline]
__sys_sendmsg+0x2a9/0x390 net/socket.c:2597
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f105f27dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f105ff830c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f105f3abf80 RCX: 00007f105f27dda9
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f105f2ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f105f3abf80 R15: 00007ffe0143a318