Patch "net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work" has been added to the 5.10-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/smc: fix 'workqueue leaked lock' in smc_conn_abort_work

to the 5.10-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-smc-fix-workqueue-leaked-lock-in-smc_conn_abort_.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 5a54a9e366090820f69a29e53914d47bead538fa
Author: Karsten Graul <kgraul@xxxxxxxxxxxxx>
Date:   Mon Sep 20 21:18:15 2021 +0200

    net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work
    
    [ Upstream commit a18cee4791b1123d0a6579a7c89f4b87e48abe03 ]
    
    The abort_work is scheduled when a connection was detected to be
    out-of-sync after a link failure. The work calls smc_conn_kill(),
    which calls smc_close_active_abort() and that might end up calling
    smc_close_cancel_work().
    smc_close_cancel_work() cancels any pending close_work and tx_work but
    needs to release the sock_lock before and acquires the sock_lock again
    afterwards. So when the sock_lock was NOT acquired before then it may
    be held after the abort_work completes. Thats why the sock_lock is
    acquired before the call to smc_conn_kill() in __smc_lgr_terminate(),
    but this is missing in smc_conn_abort_work().
    
    Fix that by acquiring the sock_lock first and release it after the
    call to smc_conn_kill().
    
    Fixes: b286a0651e44 ("net/smc: handle incoming CDC validation message")
    Signed-off-by: Karsten Graul <kgraul@xxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index af96f813c075..c491dd8e67cd 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -1089,7 +1089,9 @@ static void smc_conn_abort_work(struct work_struct *work)
 						   abort_work);
 	struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
 
+	lock_sock(&smc->sk);
 	smc_conn_kill(conn, true);
+	release_sock(&smc->sk);
 	sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
 }
 



[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