netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/1] net/smc: shutdown fix
@ 2018-04-19 13:56 Ursula Braun
  2018-04-19 13:56 ` [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN Ursula Braun
  2018-04-19 20:39 ` [PATCH net 0/1] net/smc: shutdown fix David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Ursula Braun @ 2018-04-19 13:56 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, stephen,
	ubraun

From: Ursula Braun <ubraun@linux.vnet.ibm.com>

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(-)

-- 
2.13.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN
  2018-04-19 13:56 [PATCH net 0/1] net/smc: shutdown fix Ursula Braun
@ 2018-04-19 13:56 ` Ursula Braun
  2018-04-19 20:39   ` David Miller
  2018-04-19 20:39 ` [PATCH net 0/1] net/smc: shutdown fix David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Ursula Braun @ 2018-04-19 13:56 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, stephen,
	ubraun

From: Ursula Braun <ubraun@linux.vnet.ibm.com>

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.

Fixes: 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
---
 net/smc/af_smc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 5f8046c62d90..f5d4b69dbabc 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -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;
 
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN
  2018-04-19 13:56 ` [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN Ursula Braun
@ 2018-04-19 20:39   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-19 20:39 UTC (permalink / raw)
  To: ubraun
  Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, stephen,
	ubraun

From: Ursula Braun <ubraun@linux.ibm.com>
Date: Thu, 19 Apr 2018 15:56:40 +0200

> From: Ursula Braun <ubraun@linux.vnet.ibm.com>
> 
> 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.
> 
> Fixes: 127f49705823 ("net/smc: release clcsock from tcp_listen_worker")
> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Reported-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/1] net/smc: shutdown fix
  2018-04-19 13:56 [PATCH net 0/1] net/smc: shutdown fix Ursula Braun
  2018-04-19 13:56 ` [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN Ursula Braun
@ 2018-04-19 20:39 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-19 20:39 UTC (permalink / raw)
  To: ubraun
  Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, stephen,
	ubraun

From: Ursula Braun <ubraun@linux.ibm.com>
Date: Thu, 19 Apr 2018 15:56:39 +0200

> This patch fixes the problem and is a candidate for -stable.

Ok, queueud up.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-19 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-19 13:56 [PATCH net 0/1] net/smc: shutdown fix Ursula Braun
2018-04-19 13:56 ` [PATCH net 1/1] net/smc: fix shutdown in state SMC_LISTEN Ursula Braun
2018-04-19 20:39   ` David Miller
2018-04-19 20:39 ` [PATCH net 0/1] net/smc: shutdown fix David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).