====================================================== WARNING: possible circular locking dependency detected 6.4.0-rc6-syzkaller-g858fd168a95c #0 Not tainted ------------------------------------------------------ kworker/u4:4/63 is trying to acquire lock: ffff888022f06330 (&rs->rs_recv_lock){...-}-{2:2}, at: rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 but task is already holding lock: ffff888076fec100 (&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+0x1df/0x520 kernel/locking/lockdep.c:5705 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 rds_message_purge net/rds/message.c:138 [inline] rds_message_put+0x146/0xaa0 net/rds/message.c:180 rds_inc_put net/rds/recv.c:83 [inline] rds_clear_recv_queue+0x2de/0x3b0 net/rds/recv.c:768 rds_release+0xc1/0x2e0 net/rds/af_rds.c:73 __sock_release net/socket.c:653 [inline] sock_close+0xcd/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x246/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+0x60/0x260 kernel/entry/common.c:297 do_syscall_64+0x49/0xb0 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+0x1667/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1df/0x520 kernel/locking/lockdep.c:5705 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xd9/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1c9/0x800 net/rds/send.c:634 rds_send_path_drop_acked+0x362/0x3a0 net/rds/send.c:710 rds_tcp_write_space+0x193/0x560 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5483 [inline] tcp_check_space+0x176/0xab0 net/ipv4/tcp_input.c:5502 tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline] tcp_rcv_established+0x1087/0x1f80 net/ipv4/tcp_input.c:5930 tcp_v4_do_rcv+0x6b9/0xb50 net/ipv4/tcp_ipv4.c:1722 sk_backlog_rcv include/net/sock.h:1115 [inline] __release_sock+0x198/0x4b0 net/core/sock.c:2917 release_sock+0x5d/0x1c0 net/core/sock.c:3484 rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422 rds_send_worker+0x79/0x2b0 net/rds/threads.c:200 process_one_work+0x894/0x10c0 kernel/workqueue.c:2405 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2552 kthread+0x2b0/0x340 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 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 *** 5 locks held by kworker/u4:4/63: #0: ffff888028848138 ((wq_completion)krdsd){+.+.}-{0:0}, at: process_one_work+0x77a/0x10c0 kernel/workqueue.c:2378 #1: ffffc900015e7d20 ((work_completion)(&(&cp->cp_send_w)->work)){+.+.}-{0:0}, at: process_one_work+0x7c0/0x10c0 kernel/workqueue.c:2380 #2: ffff888077c019b0 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1709 [inline] #2: ffff888077c019b0 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sock_set_cork+0x29/0x1b0 net/ipv4/tcp.c:3342 #3: ffff888077c01c38 (k-clock-AF_INET){++.-}-{2:2}, at: rds_tcp_write_space+0x30/0x560 net/rds/tcp_send.c:184 #4: ffff888076fec100 (&rm->m_rs_lock){..-.}-{2:2}, at: rds_send_remove_from_sock+0x129/0x800 net/rds/send.c:628 stack backtrace: CPU: 1 PID: 63 Comm: kworker/u4:4 Not tainted 6.4.0-rc6-syzkaller-g858fd168a95c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Workqueue: krdsd rds_send_worker Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fa/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+0x1667/0x58f0 kernel/locking/lockdep.c:3847 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088 lock_acquire+0x1df/0x520 kernel/locking/lockdep.c:5705 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline] _raw_read_lock_irqsave+0xd9/0x120 kernel/locking/spinlock.c:236 rds_wake_sk_sleep+0x2a/0xd0 net/rds/af_rds.c:109 rds_send_remove_from_sock+0x1c9/0x800 net/rds/send.c:634 rds_send_path_drop_acked+0x362/0x3a0 net/rds/send.c:710 rds_tcp_write_space+0x193/0x560 net/rds/tcp_send.c:198 tcp_new_space net/ipv4/tcp_input.c:5483 [inline] tcp_check_space+0x176/0xab0 net/ipv4/tcp_input.c:5502 tcp_data_snd_check net/ipv4/tcp_input.c:5511 [inline] tcp_rcv_established+0x1087/0x1f80 net/ipv4/tcp_input.c:5930 tcp_v4_do_rcv+0x6b9/0xb50 net/ipv4/tcp_ipv4.c:1722 sk_backlog_rcv include/net/sock.h:1115 [inline] __release_sock+0x198/0x4b0 net/core/sock.c:2917 release_sock+0x5d/0x1c0 net/core/sock.c:3484 rds_send_xmit+0x1d16/0x2530 net/rds/send.c:422 rds_send_worker+0x79/0x2b0 net/rds/threads.c:200 process_one_work+0x894/0x10c0 kernel/workqueue.c:2405 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2552 kthread+0x2b0/0x340 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308