* [PATCH net] net/smc: fix refcount non-blocking connect() -part 2
@ 2019-11-12 15:03 Karsten Graul
2019-11-12 20:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Karsten Graul @ 2019-11-12 15:03 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun
From: Ursula Braun <ubraun@linux.ibm.com>
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 301428ea3708 ("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: syzbot+4b73ad6fc767e576e275@syzkaller.appspotmail.com
Fixes: 301428ea3708 ("net/smc: fix refcounting for non-blocking connect()")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
net/smc/af_smc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index cde4dc0ed173..d0271bcb2191 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -799,6 +799,7 @@ static void smc_connect_work(struct work_struct *work)
smc->sk.sk_err = EPIPE;
else if (signal_pending(current))
smc->sk.sk_err = -sock_intr_errno(timeo);
+ sock_put(&smc->sk); /* passive closing */
goto out;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net/smc: fix refcount non-blocking connect() -part 2
2019-11-12 15:03 [PATCH net] net/smc: fix refcount non-blocking connect() -part 2 Karsten Graul
@ 2019-11-12 20:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-12 20:17 UTC (permalink / raw)
To: kgraul; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun
From: Karsten Graul <kgraul@linux.ibm.com>
Date: Tue, 12 Nov 2019 16:03:41 +0100
> From: Ursula Braun <ubraun@linux.ibm.com>
>
> 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 301428ea3708 ("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: syzbot+4b73ad6fc767e576e275@syzkaller.appspotmail.com
> Fixes: 301428ea3708 ("net/smc: fix refcounting for non-blocking connect()")
> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Applied.
And since 301428ea3708 went to -stable, I'll queue this up too.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-12 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-12 15:03 [PATCH net] net/smc: fix refcount non-blocking connect() -part 2 Karsten Graul
2019-11-12 20:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox