From: liuyacan@corp.netease.com
To: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, ubraun@linux.ibm.com,
liuyacan <liuyacan@corp.netease.com>
Subject: [PATCH v2 net] net/smc: postpone sk_refcnt increment in connect()
Date: Mon, 23 May 2022 12:57:07 +0800 [thread overview]
Message-ID: <20220523045707.1704761-1-liuyacan@corp.netease.com> (raw)
In-Reply-To: <20220523032437.1059718-1-liuyacan@corp.netease.com>
From: liuyacan <liuyacan@corp.netease.com>
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@corp.netease.com>
---
net/smc/af_smc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index fce16b9d6..45a24d242 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1564,9 +1564,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;
--
2.20.1
next prev parent reply other threads:[~2022-05-23 4:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 3:24 [PATCH net] net/smc: postpone sk_refcnt increment in connect() liuyacan
2022-05-23 4:57 ` liuyacan [this message]
2022-05-23 9:10 ` [PATCH v2 " patchwork-bot+netdevbpf
2022-05-23 12:45 ` Karsten Graul
2022-05-23 14:19 ` liuyacan
2022-05-23 14:44 ` Karsten Graul
2022-05-23 15:21 ` liuyacan
2022-05-24 11:43 ` Tony Lu
2022-05-24 12:11 ` liuyacan
2022-05-24 12:05 ` Karsten Graul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220523045707.1704761-1-liuyacan@corp.netease.com \
--to=liuyacan@corp.netease.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ubraun@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox