Skip to content

Commit a91b750

Browse files
Tetsuo Handadavem330
authored andcommitted
net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks()
syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for commit ac3615e ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") added cancel_delayed_work_sync() into a section protected by lock_sock() without realizing that rds_send_xmit() might call lock_sock(). We don't need to protect cancel_delayed_work_sync() using lock_sock(), for even if rds_{send,recv}_worker() re-queued this work while __flush_work() from cancel_delayed_work_sync() was waiting for this work to complete, retried rds_{send,recv}_worker() is no-op due to the absence of RDS_CONN_UP bit. Link: https://syzkaller.appspot.com/bug?extid=78c55c7bc6f66e53dce2 [1] Reported-by: syzbot <[email protected]> Co-developed-by: Hillf Danton <[email protected]> Signed-off-by: Hillf Danton <[email protected]> Signed-off-by: Tetsuo Handa <[email protected]> Tested-by: syzbot <[email protected]> Fixes: ac3615e ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") Signed-off-by: David S. Miller <[email protected]>
1 parent ae3ed15 commit a91b750

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/rds/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ void rds_tcp_reset_callbacks(struct socket *sock,
166166
*/
167167
atomic_set(&cp->cp_state, RDS_CONN_RESETTING);
168168
wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags));
169-
lock_sock(osock->sk);
170169
/* reset receive side state for rds_tcp_data_recv() for osock */
171170
cancel_delayed_work_sync(&cp->cp_send_w);
172171
cancel_delayed_work_sync(&cp->cp_recv_w);
172+
lock_sock(osock->sk);
173173
if (tc->t_tinc) {
174174
rds_inc_put(&tc->t_tinc->ti_inc);
175175
tc->t_tinc = NULL;

0 commit comments

Comments
 (0)