diff options
-rw-r--r-- | net/unix/af_unix.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d70fa30d4294..ae80150233b4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1608,8 +1608,15 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, mutex_lock(&u->readlock); skb = skb_recv_datagram(sk, flags, noblock, &err); - if (!skb) + if (!skb) { + unix_state_lock(sk); + /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ + if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && + (sk->sk_shutdown & RCV_SHUTDOWN)) + err = 0; + unix_state_unlock(sk); goto out_unlock; + } wake_up_interruptible(&u->peer_wait); |