======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.2048/12411 is trying to acquire lock:
ffff888023e4a3a0 (msk_lock-AF_INET){+.+.}-{0:0}, at: inet_sk_diag_fill+0xef6/0x1b50 net/ipv4/inet_diag.c:342
but task is already holding lock:
ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: mptcp_diag_dump_listeners net/mptcp/mptcp_diag.c:95 [inline]
ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: mptcp_diag_dump+0x911/0x1290 net/mptcp/mptcp_diag.c:194
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&h->lhash2[i].lock){+.+.}-{2:2}:
__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_unhash+0xd0/0x540 net/ipv4/inet_hashtables.c:658
tcp_set_state+0x35b/0x520 net/ipv4/tcp.c:2632
__tcp_close+0x91/0xf10 net/ipv4/tcp.c:2757
__mptcp_close_ssk+0x1ea/0x460 net/mptcp/protocol.c:2335
__mptcp_destroy_sock+0x3f6/0x720 net/mptcp/protocol.c:2768
mptcp_close+0x5a4/0x9f0 net/mptcp/protocol.c:2825
inet_release+0x139/0x180 net/ipv4/af_inet.c:432
__sock_release net/socket.c:649 [inline]
sock_close+0xd5/0x240 net/socket.c:1336
__fput+0x234/0x930 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0x61e/0x20a0 kernel/exit.c:883
do_group_exit+0x12e/0x300 kernel/exit.c:997
get_signal+0x6ca/0x12c0 kernel/signal.c:2900
arch_do_signal_or_restart+0xc1/0x1300 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #1 (k-sk_lock-AF_INET/1){+.+.}-{0:0}:
lock_sock_fast_nested include/net/sock.h:1734 [inline]
mptcp_close+0x297/0x9f0 net/mptcp/protocol.c:2807
inet_release+0x139/0x180 net/ipv4/af_inet.c:432
__sock_release net/socket.c:649 [inline]
sock_release+0x7b/0x140 net/socket.c:677
mptcp_pm_nl_create_listen_socket net/mptcp/pm_netlink.c:1011 [inline]
mptcp_nl_cmd_add_addr+0xa5d/0xcf0 net/mptcp/pm_netlink.c:1313
genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
genl_rcv_msg+0xbc6/0xf40 net/netlink/genetlink.c:792
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507
genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ab/0xbc0 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x190/0x250 net/socket.c:2526
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #0 (msk_lock-AF_INET){+.+.}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
lock_sock_fast include/net/sock.h:1726 [inline]
mptcp_diag_get_info+0x1db/0x990 net/mptcp/mptcp_diag.c:224
inet_sk_diag_fill+0xef6/0x1b50 net/ipv4/inet_diag.c:342
sk_diag_dump net/mptcp/mptcp_diag.c:24 [inline]
mptcp_diag_dump_listeners net/mptcp/mptcp_diag.c:122 [inline]
mptcp_diag_dump+0xcca/0x1290 net/mptcp/mptcp_diag.c:194
__inet_diag_dump+0x1f6/0x380 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x161/0x200 net/ipv4/inet_diag.c:1288
netlink_dump+0x676/0xcd0 net/netlink/af_netlink.c:2283
__netlink_dump_start+0x523/0x700 net/netlink/af_netlink.c:2386
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x1e9/0x3c0 net/ipv4/inet_diag.c:1323
sock_diag_rcv_msg+0x164/0x3e0 net/core/sock_diag.c:-1
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ab/0xbc0 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x190/0x250 net/socket.c:2526
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
other info that might help us debug this:
Chain exists of:
msk_lock-AF_INET --> k-sk_lock-AF_INET/1 --> &h->lhash2[i].lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&h->lhash2[i].lock);
lock(k-sk_lock-AF_INET/1);
lock(&h->lhash2[i].lock);
lock(msk_lock-AF_INET);
*** DEADLOCK ***
6 locks held by syz.0.2048/12411:
#0: ffffffff8d241668 (sock_diag_mutex){+.+.}-{3:3}, at: sock_diag_rcv+0x17/0x40 net/core/sock_diag.c:275
#1: ffffffff8d241528 (sock_diag_table_mutex){+.+.}-{3:3}, at: sock_diag_rcv_msg+0x14a/0x3e0 net/core/sock_diag.c:255
#2: ffff888061e1f690 (nlk_cb_mutex-SOCK_DIAG){+.+.}-{3:3}, at: __netlink_dump_start+0x11f/0x700 net/netlink/af_netlink.c:2352
#3: ffffffff8d31b988 (inet_diag_table_mutex){+.+.}-{3:3}, at: inet_diag_lock_handler net/ipv4/inet_diag.c:63 [inline]
#3: ffffffff8d31b988 (inet_diag_table_mutex){+.+.}-{3:3}, at: __inet_diag_dump+0x181/0x380 net/ipv4/inet_diag.c:1177
#4: ffffffff8c11c460 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311
#5: ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline]
#5: ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: mptcp_diag_dump_listeners net/mptcp/mptcp_diag.c:95 [inline]
#5: ffffc9000180cb68 (&h->lhash2[i].lock){+.+.}-{2:2}, at: mptcp_diag_dump+0x911/0x1290 net/mptcp/mptcp_diag.c:194
stack backtrace:
CPU: 1 PID: 12411 Comm: syz.0.2048 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
check_noncircular+0x274/0x310 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 kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
lock_sock_fast include/net/sock.h:1726 [inline]
mptcp_diag_get_info+0x1db/0x990 net/mptcp/mptcp_diag.c:224
inet_sk_diag_fill+0xef6/0x1b50 net/ipv4/inet_diag.c:342
sk_diag_dump net/mptcp/mptcp_diag.c:24 [inline]
mptcp_diag_dump_listeners net/mptcp/mptcp_diag.c:122 [inline]
mptcp_diag_dump+0xcca/0x1290 net/mptcp/mptcp_diag.c:194
__inet_diag_dump+0x1f6/0x380 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x161/0x200 net/ipv4/inet_diag.c:1288
netlink_dump+0x676/0xcd0 net/netlink/af_netlink.c:2283
__netlink_dump_start+0x523/0x700 net/netlink/af_netlink.c:2386
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x1e9/0x3c0 net/ipv4/inet_diag.c:1323
sock_diag_rcv_msg+0x164/0x3e0 net/core/sock_diag.c:-1
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ab/0xbc0 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x190/0x250 net/socket.c:2526
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fe356dbebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe355026038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fe356fe5fa0 RCX: 00007fe356dbebe9
RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000008
RBP: 00007fe356e41e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe356fe6038 R14: 00007fe356fe5fa0 R15: 00007fff55adbd08
BUG: sleeping function called from invalid context at net/core/sock.c:3283
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 12411, name: syz.0.2048
INFO: lockdep is turned off.
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 12411 Comm: syz.0.2048 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
___might_sleep+0x47c/0x600 kernel/sched/core.c:9658
__lock_sock_fast+0x2f/0xe0 net/core/sock.c:3283
lock_sock_fast include/net/sock.h:1728 [inline]
mptcp_diag_get_info+0x1e7/0x990 net/mptcp/mptcp_diag.c:224
inet_sk_diag_fill+0xef6/0x1b50 net/ipv4/inet_diag.c:342
sk_diag_dump net/mptcp/mptcp_diag.c:24 [inline]
mptcp_diag_dump_listeners net/mptcp/mptcp_diag.c:122 [inline]
mptcp_diag_dump+0xcca/0x1290 net/mptcp/mptcp_diag.c:194
__inet_diag_dump+0x1f6/0x380 net/ipv4/inet_diag.c:1179
inet_diag_dump_compat+0x161/0x200 net/ipv4/inet_diag.c:1288
netlink_dump+0x676/0xcd0 net/netlink/af_netlink.c:2283
__netlink_dump_start+0x523/0x700 net/netlink/af_netlink.c:2386
netlink_dump_start include/linux/netlink.h:258 [inline]
inet_diag_rcv_msg_compat+0x1e9/0x3c0 net/ipv4/inet_diag.c:1323
sock_diag_rcv_msg+0x164/0x3e0 net/core/sock_diag.c:-1
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507
sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ab/0xbc0 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x190/0x250 net/socket.c:2526
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fe356dbebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe355026038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fe356fe5fa0 RCX: 00007fe356dbebe9
RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000008
RBP: 00007fe356e41e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe356fe6038 R14: 00007fe356fe5fa0 R15: 00007fff55adbd08