diff options
author | liuyacan <liuyacan@corp.netease.com> | 2022-05-23 07:57:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 19:11:39 +0300 |
commit | 60546c0b4b46724f480da371360adc5c685ece01 (patch) | |
tree | b7bffd271cdb2607122ec4d5c46f9376b022ee6a /net | |
parent | 91121ee57414ea0244b7fe4f99b5f396d0811952 (diff) | |
download | linux-60546c0b4b46724f480da371360adc5c685ece01.tar.xz |
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@corp.netease.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/af_smc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index a5a8cca46bd5..394491692a07 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -877,9 +877,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 (schedule_work(&smc->connect_work)) smc->connect_nonblock = 1; |