Skip to content

Commit 75c1edf

Browse files
liuyacandavem330
authored andcommitted
net/smc: postpone sk_refcnt increment in connect()
Same trigger condition as commit 8643474. 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: 8643474 ("net/smc: add fallback check to connect()") Signed-off-by: liuyacan <liuyacan@corp.netease.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0a3ad7d commit 75c1edf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/smc/af_smc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,9 +1564,9 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr,
15641564
if (rc && rc != -EINPROGRESS)
15651565
goto out;
15661566

1567-
sock_hold(&smc->sk); /* sock put in passive closing */
15681567
if (smc->use_fallback)
15691568
goto out;
1569+
sock_hold(&smc->sk); /* sock put in passive closing */
15701570
if (flags & O_NONBLOCK) {
15711571
if (queue_work(smc_hs_wq, &smc->connect_work))
15721572
smc->connect_nonblock = 1;

0 commit comments

Comments
 (0)