summaryrefslogtreecommitdiffstats
path: root/net/smc/smc_close.c
diff options
context:
space:
mode:
authorD. Wythe <alibuda@linux.alibaba.com>2023-11-03 07:07:40 +0100
committerDavid S. Miller <davem@davemloft.net>2023-11-06 11:01:07 +0100
commitaa96fbd6d78d9770323b21e2c92bd38821be8852 (patch)
treeacf6792f94adb9a2396b69cffd87e34d9632060a /net/smc/smc_close.c
parentnet/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc (diff)
downloadlinux-aa96fbd6d78d9770323b21e2c92bd38821be8852.tar.xz
linux-aa96fbd6d78d9770323b21e2c92bd38821be8852.zip
net/smc: put sk reference if close work was canceled
Note that we always hold a reference to sock when attempting to submit close_work. Therefore, if we have successfully canceled close_work from pending, we MUST release that reference to avoid potential leaks. Fixes: 42bfba9eaa33 ("net/smc: immediate termination for SMCD link groups") Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/smc_close.c')
-rw-r--r--net/smc/smc_close.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 449ef454b53b..10219f55aad1 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -116,7 +116,8 @@ static void smc_close_cancel_work(struct smc_sock *smc)
struct sock *sk = &smc->sk;
release_sock(sk);
- cancel_work_sync(&smc->conn.close_work);
+ if (cancel_work_sync(&smc->conn.close_work))
+ sock_put(sk);
cancel_delayed_work_sync(&smc->conn.tx_work);
lock_sock(sk);
}