====================================================== WARNING: possible circular locking dependency detected 5.7.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/13525 is trying to acquire lock: ffff88808bdab658 (&rs->rs_recv_lock){..--}-{2:2}, at: rds_wake_sk_sleep+0x1f/0xe0 net/rds/af_rds.c:109 but task is already holding lock: ffff888050ad2900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x35a/0xa00 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}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:159 rds_message_purge net/rds/message.c:138 [inline] rds_message_put net/rds/message.c:180 [inline] rds_message_put+0x1d5/0xd90 net/rds/message.c:173 rds_inc_put+0x13a/0x1a0 net/rds/recv.c:82 rds_clear_recv_queue+0x14a/0x350 net/rds/recv.c:770 rds_release+0x102/0x3f0 net/rds/af_rds.c:73 __sock_release+0xcd/0x280 net/socket.c:605 sock_close+0x18/0x20 net/socket.c:1278 __fput+0x33e/0x880 fs/file_table.c:281 task_work_run+0xf4/0x1b0 kernel/task_work.c:123 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x2fa/0x360 arch/x86/entry/common.c:165 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:279 [inline] do_syscall_64+0x6b1/0x7d0 arch/x86/entry/common.c:305 entry_SYSCALL_64_after_hwframe+0x49/0xb3 -> #0 (&rs->rs_recv_lock){..--}-{2:2}: check_prev_add kernel/locking/lockdep.c:2496 [inline] check_prevs_add kernel/locking/lockdep.c:2601 [inline] validate_chain kernel/locking/lockdep.c:3218 [inline] __lock_acquire+0x2a9c/0x4a70 kernel/locking/lockdep.c:4380 lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4959 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [inline] _raw_read_lock_irqsave+0x93/0xd0 kernel/locking/spinlock.c:231 rds_wake_sk_sleep+0x1f/0xe0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0xc1/0xa00 net/rds/send.c:634 rds_send_path_drop_acked+0x303/0x3d0 net/rds/send.c:710 rds_tcp_write_space+0x1a7/0x658 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5226 [inline] tcp_check_space+0x178/0x730 net/ipv4/tcp_input.c:5237 tcp_data_snd_check net/ipv4/tcp_input.c:5247 [inline] tcp_rcv_established+0x17dc/0x1d90 net/ipv4/tcp_input.c:5654 tcp_v4_do_rcv+0x605/0x8b0 net/ipv4/tcp_ipv4.c:1629 sk_backlog_rcv include/net/sock.h:996 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2548 release_sock+0x54/0x1b0 net/core/sock.c:3064 rds_send_xmit+0x1487/0x2510 net/rds/send.c:422 rds_sendmsg+0x273d/0x3100 net/rds/send.c:1381 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352 ___sys_sendmsg+0x100/0x170 net/socket.c:2406 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 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); lock(&rs->rs_recv_lock); *** DEADLOCK *** 3 locks held by syz-executor.0/13525: #0: ffff888064497020 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1576 [inline] #0: ffff888064497020 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x16/0x90 net/ipv4/tcp.c:2829 #1: ffff8880644972c8 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x25/0x658 net/rds/tcp_send.c:184 #2: ffff888050ad2900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x35a/0xa00 net/rds/send.c:628 stack backtrace: CPU: 1 PID: 13525 Comm: syz-executor.0 Not tainted 5.7.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x188/0x20d lib/dump_stack.c:118 check_noncircular+0x32e/0x3e0 kernel/locking/lockdep.c:1827 check_prev_add kernel/locking/lockdep.c:2496 [inline] check_prevs_add kernel/locking/lockdep.c:2601 [inline] validate_chain kernel/locking/lockdep.c:3218 [inline] __lock_acquire+0x2a9c/0x4a70 kernel/locking/lockdep.c:4380 lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4959 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [inline] _raw_read_lock_irqsave+0x93/0xd0 kernel/locking/spinlock.c:231 rds_wake_sk_sleep+0x1f/0xe0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0xc1/0xa00 net/rds/send.c:634 rds_send_path_drop_acked+0x303/0x3d0 net/rds/send.c:710 rds_tcp_write_space+0x1a7/0x658 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5226 [inline] tcp_check_space+0x178/0x730 net/ipv4/tcp_input.c:5237 tcp_data_snd_check net/ipv4/tcp_input.c:5247 [inline] tcp_rcv_established+0x17dc/0x1d90 net/ipv4/tcp_input.c:5654 tcp_v4_do_rcv+0x605/0x8b0 net/ipv4/tcp_ipv4.c:1629 sk_backlog_rcv include/net/sock.h:996 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2548 release_sock+0x54/0x1b0 net/core/sock.c:3064 rds_send_xmit+0x1487/0x2510 net/rds/send.c:422 rds_sendmsg+0x273d/0x3100 net/rds/send.c:1381 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352 ___sys_sendmsg+0x100/0x170 net/socket.c:2406 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x45ca59 Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f6d9be39c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000005019e0 RCX: 000000000045ca59 RDX: 0000000000000040 RSI: 0000000020000240 RDI: 0000000000000004 RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000000a1d R14: 00000000004cd008 R15: 00007f6d9be3a6d4