net/smc: shutdown fix
cover net/smc: shutdown fix
From: Ursula Braun <[email protected]>
Dave,
Stephen Hemminger reported this problem recently:
https://bugzilla.kernel.org/show_bug.cgi?id=199429
This patch fixes the problem and is a candidate for -stable.
Thanks, Ursula
Ursula Braun (1):
net/smc: fix shutdown in state SMC_LISTEN
net/smc/af_smc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
Signature · 1 line
2.13.5
PATCH 1/1 net/smc: fix shutdown in state SMC_LISTEN
From: Ursula Braun <[email protected]>
Calling shutdown with SHUT_RD and SHUT_RDWR for a listening SMC socket crashes, because
commit 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")
releases the internal clcsock in smc_close_active() and sets smc->clcsock to NULL.
For SHUT_RD the smc_close_active() call is removed.
For SHUT_RDWR the kernel_sock_shutdown() call is omitted, since the clcsock is already released.
--- net/smc/af_smc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/smc/af_smc.c +4 -6
@@ -1259,14 +1259,12 @@ static int smc_shutdown(struct socket *sock, int how) rc =smc_close_shutdown_write (smc);break ;case SHUT_RD : -if (sk->sk_state ==SMC_LISTEN ) - rc =smc_close_active (smc); -else - rc =0 ; -/* nothing more to do because peer is not involved */ + rc =0 ; +/* nothing more to do because peer is not involved */ break ; } - rc1 =kernel_sock_shutdown (smc->clcsock, how); +if (smc->clcsock) + rc1 =kernel_sock_shutdown (smc->clcsock, how);/* map sock_shutdown_cmd constants to sk_shutdown value range */ sk->sk_shutdown |= how +1 ;
Signature · 1 line
2.13.5
Re: [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN
From: Ursula Braun <[email protected]>
Date: Thu, 19 Apr 2018 15:56:40 +0200
Quoted 11 lines
From: Ursula Braun <[email protected]>
Calling shutdown with
SHUT_RDandSHUT_RDWRfor a listening SMC socket crashes, because
commit127f49705823("net/smc: release clcsock fromtcp_listen_worker")
releases the internal clcsock insmc_close_active()and setssmc->clcsockto NULL.
ForSHUT_RDthesmc_close_active()call is removed.
ForSHUT_RDWRthekernel_sock_shutdown()call is omitted, since the clcsock is already released.
Quoted 3 lines
Fixes 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")Signed-off-by Ursula Braun <[email protected]>Reported-by Stephen Hemminger <[email protected]>
Applied, thank you.
David Miller
maintainerFrom: Ursula Braun <[email protected]>
Date: Thu, 19 Apr 2018 15:56:39 +0200
Quoted 1 line
This patch fixes the problem and is a candidate for -stable.
Ok, queueud up.