Patch "net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks()" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks()

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-rds-don-t-hold-sock-lock-when-cancelling-work-fr.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 773154772051ec826979e89044c7f254c32a1aba
Author: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Date:   Thu Sep 29 00:25:37 2022 +0900

    net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks()
    
    [ Upstream commit a91b750fd6629354460282bbf5146c01b05c4859 ]
    
    syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for
    commit ac3615e7f3cffe2a ("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 <syzbot+78c55c7bc6f66e53dce2@xxxxxxxxxxxxxxxxxxxxxxxxx>
    Co-developed-by: Hillf Danton <hdanton@xxxxxxxx>
    Signed-off-by: Hillf Danton <hdanton@xxxxxxxx>
    Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
    Tested-by: syzbot <syzbot+78c55c7bc6f66e53dce2@xxxxxxxxxxxxxxxxxxxxxxxxx>
    Fixes: ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()")
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index d4e6466d3989..645cbb17c13a 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -176,10 +176,10 @@ void rds_tcp_reset_callbacks(struct socket *sock,
 	 */
 	atomic_set(&cp->cp_state, RDS_CONN_RESETTING);
 	wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags));
-	lock_sock(osock->sk);
 	/* reset receive side state for rds_tcp_data_recv() for osock  */
 	cancel_delayed_work_sync(&cp->cp_send_w);
 	cancel_delayed_work_sync(&cp->cp_recv_w);
+	lock_sock(osock->sk);
 	if (tc->t_tinc) {
 		rds_inc_put(&tc->t_tinc->ti_inc);
 		tc->t_tinc = NULL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux