Patch "net/smc: postpone sk_refcnt increment in connect()" has been added to the 5.15-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: postpone sk_refcnt increment in connect()

to the 5.15-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-postpone-sk_refcnt-increment-in-connect.patch
and it can be found in the queue-5.15 subdirectory.

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



commit b59b0d9b88930db33a9dbe7c0e904c15869f365a
Author: liuyacan <liuyacan@xxxxxxxxxxxxxxxx>
Date:   Mon May 23 12:57:07 2022 +0800

    net/smc: postpone sk_refcnt increment in connect()
    
    [ Upstream commit 75c1edf23b95a9c66923d9269d8e86e4dbde151f ]
    
    Same trigger condition as commit 86434744. When setsockopt runs
    in parallel to a connect(), and switch the socket into fallback
    mode. Then the sk_refcnt is incremented in smc_connect(), but
    its state stay in SMC_INIT (NOT SMC_ACTIVE). This cause the
    corresponding sk_refcnt decrement in __smc_release() will not be
    performed.
    
    Fixes: 86434744fedf ("net/smc: add fallback check to connect()")
    Signed-off-by: liuyacan <liuyacan@xxxxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index fb801c249d92..2ddd7b34b4ce 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1283,9 +1283,9 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr,
 	if (rc && rc != -EINPROGRESS)
 		goto out;
 
-	sock_hold(&smc->sk); /* sock put in passive closing */
 	if (smc->use_fallback)
 		goto out;
+	sock_hold(&smc->sk); /* sock put in passive closing */
 	if (flags & O_NONBLOCK) {
 		if (queue_work(smc_hs_wq, &smc->connect_work))
 			smc->connect_nonblock = 1;



[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