Skip to content

Commit 6d6dd52

Browse files
Ursula Braundavem330
authored andcommitted
net/smc: fix refcount non-blocking connect() -part 2
If an SMC socket is immediately terminated after a non-blocking connect() has been called, a memory leak is possible. Due to the sock_hold move in commit 301428e ("net/smc: fix refcounting for non-blocking connect()") an extra sock_put() is needed in smc_connect_work(), if the internal TCP socket is aborted and cancels the sk_stream_wait_connect() of the connect worker. Reported-by: [email protected] Fixes: 301428e ("net/smc: fix refcounting for non-blocking connect()") Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1d46395 commit 6d6dd52

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/smc/af_smc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ static void smc_connect_work(struct work_struct *work)
796796
smc->sk.sk_err = EPIPE;
797797
else if (signal_pending(current))
798798
smc->sk.sk_err = -sock_intr_errno(timeo);
799+
sock_put(&smc->sk); /* passive closing */
799800
goto out;
800801
}
801802

0 commit comments

Comments
 (0)