Commit f9cedf1a authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

net/smc: do not schedule tx_work in SMC_CLOSED state

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: syzbot+92209502e7aab127c75f@syzkaller.appspotmail.com
Reported-by: syzbot+b972214bb803a343f4fe@syzkaller.appspotmail.com
Fixes: 01d2f7e2 ("net/smc: sockopts TCP_NODELAY and TCP_CORK")
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 438b43bd
...@@ -1732,14 +1732,18 @@ static int smc_setsockopt(struct socket *sock, int level, int optname, ...@@ -1732,14 +1732,18 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
} }
break; break;
case TCP_NODELAY: 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) if (val && !smc->use_fallback)
mod_delayed_work(system_wq, &smc->conn.tx_work, mod_delayed_work(system_wq, &smc->conn.tx_work,
0); 0);
} }
break; break;
case TCP_CORK: 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) if (!val && !smc->use_fallback)
mod_delayed_work(system_wq, &smc->conn.tx_work, mod_delayed_work(system_wq, &smc->conn.tx_work,
0); 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment