====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc5-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/6594 is trying to acquire lock: ffff8880254d2528 (&rs->rs_recv_lock){....}-{2:2}, at: rds_wake_sk_sleep+0x2e/0xd0 net/rds/af_rds.c:109 but task is already holding lock: ffff888022228100 (&rm->m_rs_lock){....}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 net/rds/send.c:628 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&rm->m_rs_lock){....}-{2:2}: lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 rds_message_purge net/rds/message.c:138 [inline] rds_message_put+0x14a/0xaa0 net/rds/message.c:180 rds_inc_put net/rds/recv.c:83 [inline] rds_clear_recv_queue+0x2e2/0x3b0 net/rds/recv.c:768 rds_release+0xc5/0x2e0 net/rds/af_rds.c:73 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&rs->rs_recv_lock){....}-{2:2}: check_prev_add kernel/locking/lockdep.c:3113 [inline] check_prevs_add kernel/locking/lockdep.c:3232 [inline] validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xdd/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2e/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1c9/0x800 net/rds/send.c:634 rds_send_path_drop_acked+0x366/0x3b0 net/rds/send.c:710 rds_tcp_write_space+0x197/0x560 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5483 [inline] tcp_check_space+0x17a/0xac0 net/ipv4/tcp_input.c:5502 tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline] tcp_rcv_established+0xb2a/0x2010 net/ipv4/tcp_input.c:6021 tcp_v4_do_rcv+0x68e/0xaf0 net/ipv4/tcp_ipv4.c:1722 sk_backlog_rcv include/net/sock.h:1115 [inline] __release_sock+0xf3/0x3a0 net/core/sock.c:2917 release_sock+0x61/0x1c0 net/core/sock.c:3484 rds_send_xmit+0x1d1a/0x2530 net/rds/send.c:422 rds_sendmsg+0x1b99/0x2240 net/rds/send.c:1381 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] ____sys_sendmsg+0x58f/0x890 net/socket.c:2503 ___sys_sendmsg net/socket.c:2557 [inline] __sys_sendmsg+0x2ad/0x390 net/socket.c:2586 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&rm->m_rs_lock); lock(&rs->rs_recv_lock); lock(&rm->m_rs_lock); rlock(&rs->rs_recv_lock); *** DEADLOCK *** 3 locks held by syz-executor.0/6594: #0: ffff88802c36cab0 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1701 [inline] #0: ffff88802c36cab0 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x2d/0x1b0 net/ipv4/tcp.c:3342 #1: ffff88802c36cd38 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x34/0x560 net/rds/tcp_send.c:184 #2: ffff888022228100 (&rm->m_rs_lock){....}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 net/rds/send.c:628 stack backtrace: CPU: 0 PID: 6594 Comm: syz-executor.0 Not tainted 6.4.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2188 check_prev_add kernel/locking/lockdep.c:3113 [inline] check_prevs_add kernel/locking/lockdep.c:3232 [inline] validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xdd/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2e/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1c9/0x800 net/rds/send.c:634 rds_send_path_drop_acked+0x366/0x3b0 net/rds/send.c:710 rds_tcp_write_space+0x197/0x560 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5483 [inline] tcp_check_space+0x17a/0xac0 net/ipv4/tcp_input.c:5502 tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline] tcp_rcv_established+0xb2a/0x2010 net/ipv4/tcp_input.c:6021 tcp_v4_do_rcv+0x68e/0xaf0 net/ipv4/tcp_ipv4.c:1722 sk_backlog_rcv include/net/sock.h:1115 [inline] __release_sock+0xf3/0x3a0 net/core/sock.c:2917 release_sock+0x61/0x1c0 net/core/sock.c:3484 rds_send_xmit+0x1d1a/0x2530 net/rds/send.c:422 rds_sendmsg+0x1b99/0x2240 net/rds/send.c:1381 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] ____sys_sendmsg+0x58f/0x890 net/socket.c:2503 ___sys_sendmsg net/socket.c:2557 [inline] __sys_sendmsg+0x2ad/0x390 net/socket.c:2586 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe31bc8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe31c9be168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007fe31bdac050 RCX: 00007fe31bc8c169 RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000004 RBP: 00007fe31bce7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe72c9da1f R14: 00007fe31c9be300 R15: 0000000000022000