Skip to contentSkip to conversation

net/smc: do not schedule tx_work in SMC_CLOSED state

PATCH In review Karsten Graul 2 participants 2 messages Aug 2, 2019 – Aug 5, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/smc: do not schedule tx_work in SMC_CLOSED state

From: Ursula Braun <[email protected]>

The setsockopts options TCP_NODELAY and TCP_CORK may schedule the tx worker. Make sure the socket is not yet moved into SMC_CLOSED state (for instance by a shutdown SHUT_RDWR call).

Reported-by [email protected]
Reported-by [email protected]
Fixes 01d2f7e2cdd31 ("net/smc: sockopts TCP_NODELAY and TCP_CORK")
---
 net/smc/af_smc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
net/smc/af_smc.c +6 -2
index 302e355f2ebc..f5ea09258ab0 100644
@@ -1732,14 +1732,18 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
 		}
 		break;
 	case TCP_NODELAY:
-		if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
+		if (sk->sk_state != SMC_INIT &&
+		    sk->sk_state != SMC_LISTEN &&
+		    sk->sk_state != SMC_CLOSED) {
 			if (val && !smc->use_fallback)
 				mod_delayed_work(system_wq, &smc->conn.tx_work,
 						 0);
 		}
 		break;
 	case TCP_CORK:
-		if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
+		if (sk->sk_state != SMC_INIT &&
+		    sk->sk_state != SMC_LISTEN &&
+		    sk->sk_state != SMC_CLOSED) {
 			if (!val && !smc->use_fallback)
 				mod_delayed_work(system_wq, &smc->conn.tx_work,
 						 0);
Signature · 1 line
2.21.0
maintainer
#1 lore raw

From: Karsten Graul <[email protected]>
Date: Fri, 2 Aug 2019 10:16:38 +0200

Quoted 11 lines

From: Ursula Braun <[email protected]>

The setsockopts options TCP_NODELAY and TCP_CORK may schedule the tx worker. Make sure the socket is not yet moved into SMC_CLOSED state (for instance by a shutdown SHUT_RDWR call).

Reported-by [email protected]
Reported-by [email protected]
Fixes 01d2f7e2cdd31 ("net/smc: sockopts TCP_NODELAY and TCP_CORK")

Applied and queued up for -stable.