Skip to content

Commit aa96fbd

Browse files
D. Wythedavem330
authored andcommitted
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: 42bfba9 ("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>
1 parent c5bf605 commit aa96fbd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/smc/smc_close.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ static void smc_close_cancel_work(struct smc_sock *smc)
116116
struct sock *sk = &smc->sk;
117117

118118
release_sock(sk);
119-
cancel_work_sync(&smc->conn.close_work);
119+
if (cancel_work_sync(&smc->conn.close_work))
120+
sock_put(sk);
120121
cancel_delayed_work_sync(&smc->conn.tx_work);
121122
lock_sock(sk);
122123
}

0 commit comments

Comments
 (0)