Merge tag 'media/v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[linux-2.6-microblaze.git] / net / iucv / af_iucv.c
index d805720..047238f 100644 (file)
@@ -1434,7 +1434,8 @@ static int iucv_sock_shutdown(struct socket *sock, int how)
                break;
        }
 
-       if (how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) {
+       if ((how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) &&
+           sk->sk_state == IUCV_CONNECTED) {
                if (iucv->transport == AF_IUCV_TRANS_IUCV) {
                        txmsg.class = 0;
                        txmsg.tag = 0;