======================================================
WARNING: possible circular locking dependency detected
5.15.150-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/9362 is trying to acquire lock:
ffff8880396e3420 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
ffff8880396e3420 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: tcp_diag_get_aux+0x70a/0x7e0 net/ipv4/tcp_diag.c:137
but task is already holding lock:
ffffc90001373888 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
ffffc90001373888 (&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+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
_raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:363 [inline]
__inet_hash+0xe3/0x920 net/ipv4/inet_hashtables.c:606
inet_csk_listen_start+0x231/0x310 net/ipv4/inet_connection_sock.c:1084
inet_listen+0x2c9/0x7c0 net/ipv4/af_inet.c:231
rds_tcp_listen_init+0x3f5/0x590 net/rds/tcp_listen.c:311
rds_tcp_init_net+0x138/0x310 net/rds/tcp.c:559
ops_init+0x356/0x600 net/core/net_namespace.c:135
__register_pernet_operations net/core/net_namespace.c:1147 [inline]
register_pernet_operations+0x2c7/0x650 net/core/net_namespace.c:1216
register_pernet_device+0x2f/0x80 net/core/net_namespace.c:1303
rds_tcp_init+0x5e/0xd0 net/rds/tcp.c:717
do_one_initcall+0x22b/0x7a0 init/main.c:1299
do_initcall_level+0x157/0x207 init/main.c:1372
do_initcalls+0x49/0x86 init/main.c:1388
kernel_init_freeable+0x425/0x5b5 init/main.c:1612
kernel_init+0x19/0x290 init/main.c:1503
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
-> #0 (k-sk_lock-AF_INET6){+.+.}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
lock_sock_fast include/net/sock.h:1700 [inline]
subflow_get_info+0x156/0xcd0 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x70a/0x7e0 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0xfb4/0x1cb0 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+0x606/0xc40 net/netlink/af_netlink.c:2279
__netlink_dump_start+0x52f/0x6f0 net/netlink/af_netlink.c:2384
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
__sys_sendmsg net/socket.c:2514 [inline]
__do_sys_sendmsg net/socket.c:2523 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&h->lhash2[i].lock);
lock(k-sk_lock-AF_INET6);
lock(&h->lhash2[i].lock);
lock(k-sk_lock-AF_INET6);
*** DEADLOCK ***
5 locks held by syz-executor.3/9362:
#0: ffffffff8d9e5588 (sock_diag_mutex){+.+.}-{3:3}, at: sock_diag_rcv+0x17/0x40 net/core/sock_diag.c:275
#1: ffffffff8d9e53e8 (sock_diag_table_mutex){+.+.}-{3:3}, at: sock_diag_rcv_msg+0xb8/0x400 net/core/sock_diag.c:255
#2: ffff88807845f690 (nlk_cb_mutex-SOCK_DIAG){+.+.}-{3:3}, at: netlink_dump+0xd0/0xc40 net/netlink/af_netlink.c:2227
#3: ffffffff8dac1ac8 (inet_diag_table_mutex){+.+.}-{3:3}, at: inet_diag_lock_handler net/ipv4/inet_diag.c:63 [inline]
#3: ffffffff8dac1ac8 (inet_diag_table_mutex){+.+.}-{3:3}, at: __inet_diag_dump+0x191/0x3a0 net/ipv4/inet_diag.c:1177
#4: ffffc90001373888 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
#4: ffffc90001373888 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_diag_dump_icsk+0x32c/0x1520 net/ipv4/inet_diag.c:1038
stack backtrace:
CPU: 1 PID: 9362 Comm: syz-executor.3 Not tainted 5.15.150-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
lock_sock_fast include/net/sock.h:1700 [inline]
subflow_get_info+0x156/0xcd0 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x70a/0x7e0 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0xfb4/0x1cb0 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+0x606/0xc40 net/netlink/af_netlink.c:2279
__netlink_dump_start+0x52f/0x6f0 net/netlink/af_netlink.c:2384
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
__sys_sendmsg net/socket.c:2514 [inline]
__do_sys_sendmsg net/socket.c:2523 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f16bebdcda9
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:00007f16bd15d0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f16bed0af80 RCX: 00007f16bebdcda9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 00007f16bec2947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f16bed0af80 R15: 00007fff613a46d8
</TASK>
BUG: sleeping function called from invalid context at net/core/sock.c:3271
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 9362, name: syz-executor.3
INFO: lockdep is turned off.
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 9362 Comm: syz-executor.3 Not tainted 5.15.150-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
___might_sleep+0x547/0x6a0 kernel/sched/core.c:9626
__lock_sock_fast+0x2f/0xe0 net/core/sock.c:3271
lock_sock_fast include/net/sock.h:1702 [inline]
subflow_get_info+0x162/0xcd0 net/mptcp/diag.c:28
tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
tcp_diag_get_aux+0x70a/0x7e0 net/ipv4/tcp_diag.c:137
inet_sk_diag_fill+0xfb4/0x1cb0 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+0x606/0xc40 net/netlink/af_netlink.c:2279
__netlink_dump_start+0x52f/0x6f0 net/netlink/af_netlink.c:2384
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x202/0x4c0 net/ipv4/inet_diag.c:1321
sock_diag_rcv_msg+0xd5/0x400
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
__sys_sendmsg net/socket.c:2514 [inline]
__do_sys_sendmsg net/socket.c:2523 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f16bebdcda9
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:00007f16bd15d0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f16bed0af80 RCX: 00007f16bebdcda9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 00007f16bec2947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f16bed0af80 R15: 00007fff613a46d8
</TASK>