summaryrefslogtreecommitdiffstats
path: root/net/smc/af_smc.c
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.ibm.com>2018-08-08 14:13:19 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-24 13:07:16 +0200
commit3cb744554f4d686fdf01dd24d6df57e0f260a96e (patch)
tree592c4b73c3a7368c549ac8bed3dec027058c2442 /net/smc/af_smc.c
parent4713ad95833b593a50f7162e503c6c791dc050a9 (diff)
downloadlinux-stable-3cb744554f4d686fdf01dd24d6df57e0f260a96e.tar.gz
linux-stable-3cb744554f4d686fdf01dd24d6df57e0f260a96e.tar.bz2
linux-stable-3cb744554f4d686fdf01dd24d6df57e0f260a96e.zip
net/smc: no shutdown in state SMC_LISTEN
commit caa21e19e08d7a1445116a93f7ab4e187ebbbadb upstream. Invoking shutdown for a socket in state SMC_LISTEN does not make sense. Nevertheless programs like syzbot fuzzing the kernel may try to do this. For SMC this means a socket refcounting problem. This patch makes sure a shutdown call for an SMC socket in state SMC_LISTEN simply returns with -ENOTCONN. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r--net/smc/af_smc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 544bab42f925..9c5f447fa366 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1231,8 +1231,7 @@ static int smc_shutdown(struct socket *sock, int how)
lock_sock(sk);
rc = -ENOTCONN;
- if ((sk->sk_state != SMC_LISTEN) &&
- (sk->sk_state != SMC_ACTIVE) &&
+ if ((sk->sk_state != SMC_ACTIVE) &&
(sk->sk_state != SMC_PEERCLOSEWAIT1) &&
(sk->sk_state != SMC_PEERCLOSEWAIT2) &&
(sk->sk_state != SMC_APPCLOSEWAIT1) &&