====================================================== WARNING: possible circular locking dependency detected 5.9.0-rc1-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/26550 is trying to acquire lock: ffff888056774d58 (&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: ffff8880a801d900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x340/0x9e0 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/0xc0 kernel/locking/spinlock.c:159 rds_message_purge net/rds/message.c:138 [inline] rds_message_put+0x1d8/0xe30 net/rds/message.c:180 rds_inc_put+0x13a/0x1a0 net/rds/recv.c:82 rds_clear_recv_queue+0x147/0x350 net/rds/recv.c:771 rds_release+0xd4/0x3b0 net/rds/af_rds.c:73 __sock_release+0xcd/0x280 net/socket.c:596 sock_close+0x18/0x20 net/socket.c:1277 __fput+0x285/0x920 fs/file_table.c:281 task_work_run+0xdd/0x190 kernel/task_work.c:141 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:140 [inline] exit_to_user_mode_prepare+0x195/0x1c0 kernel/entry/common.c:167 syscall_exit_to_user_mode+0x59/0x2b0 kernel/entry/common.c:242 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #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+0x2a6b/0x5640 kernel/locking/lockdep.c:4426 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:5005 __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+0xb9/0x9e0 net/rds/send.c:634 rds_send_path_drop_acked+0x2ef/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:5350 [inline] tcp_check_space+0x178/0x730 net/ipv4/tcp_input.c:5361 tcp_data_snd_check net/ipv4/tcp_input.c:5371 [inline] tcp_rcv_established+0x1400/0x1eb0 net/ipv4/tcp_input.c:5780 tcp_v4_do_rcv+0x5d1/0x870 net/ipv4/tcp_ipv4.c:1643 sk_backlog_rcv include/net/sock.h:1011 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2528 release_sock+0x54/0x1b0 net/core/sock.c:3051 rds_send_xmit+0x142f/0x24b0 net/rds/send.c:422 rds_sendmsg+0x27b2/0x2fd0 net/rds/send.c:1382 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:671 __sys_sendto+0x21c/0x320 net/socket.c:1992 __do_sys_sendto net/socket.c:2004 [inline] __se_sys_sendto net/socket.c:2000 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2000 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 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.4/26550: #0: ffff8880a8a9c5a0 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1583 [inline] #0: ffff8880a8a9c5a0 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at: tcp_sock_set_cork+0x16/0x90 net/ipv4/tcp.c:2893 #1: ffff8880a8a9c848 (clock-AF_INET6){++.-}-{2:2}, at: rds_tcp_write_space+0x25/0x658 net/rds/tcp_send.c:184 #2: ffff8880a801d900 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x340/0x9e0 net/rds/send.c:628 stack backtrace: CPU: 0 PID: 26550 Comm: syz-executor.4 Not tainted 5.9.0-rc1-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+0x18f/0x20d lib/dump_stack.c:118 check_noncircular+0x324/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+0x2a6b/0x5640 kernel/locking/lockdep.c:4426 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:5005 __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+0xb9/0x9e0 net/rds/send.c:634 rds_send_path_drop_acked+0x2ef/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:5350 [inline] tcp_check_space+0x178/0x730 net/ipv4/tcp_input.c:5361 tcp_data_snd_check net/ipv4/tcp_input.c:5371 [inline] tcp_rcv_established+0x1400/0x1eb0 net/ipv4/tcp_input.c:5780 tcp_v4_do_rcv+0x5d1/0x870 net/ipv4/tcp_ipv4.c:1643 sk_backlog_rcv include/net/sock.h:1011 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2528 release_sock+0x54/0x1b0 net/core/sock.c:3051 rds_send_xmit+0x142f/0x24b0 net/rds/send.c:422 rds_sendmsg+0x27b2/0x2fd0 net/rds/send.c:1382 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:671 __sys_sendto+0x21c/0x320 net/socket.c:1992 __do_sys_sendto net/socket.c:2004 [inline] __se_sys_sendto net/socket.c:2000 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2000 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45d5b9 Code: 5d b4 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 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f1fb3380c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 000000000002d140 RCX: 000000000045d5b9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 000000000118cf98 R08: 0000000020000040 R09: 0000000000000010 R10: 0000000000000040 R11: 0000000000000246 R12: 000000000118cf4c R13: 00007ffdc2b88e1f R14: 00007f1fb33819c0 R15: 000000000118cf4c