Skip to content

Commit 0884d7a

Browse files
ubytedavem330
authored andcommitted
AF_UNIX: Fix poll blocking problem when reading from a stream socket
poll() call may be blocked by concurrent reading from the same stream socket. Signed-off-by: Alexey Moiseytsev <himeraster@gmail.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 83b98fb commit 0884d7a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎net/unix/af_unix.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
19571957
if ((UNIXCB(skb).pid != siocb->scm->pid) ||
19581958
(UNIXCB(skb).cred != siocb->scm->cred)) {
19591959
skb_queue_head(&sk->sk_receive_queue, skb);
1960+
sk->sk_data_ready(sk, skb->len);
19601961
break;
19611962
}
19621963
} else {
@@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
19741975
chunk = min_t(unsigned int, skb->len, size);
19751976
if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
19761977
skb_queue_head(&sk->sk_receive_queue, skb);
1978+
sk->sk_data_ready(sk, skb->len);
19771979
if (copied == 0)
19781980
copied = -EFAULT;
19791981
break;
@@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
19911993
/* put the skb back if we didn't use it up.. */
19921994
if (skb->len) {
19931995
skb_queue_head(&sk->sk_receive_queue, skb);
1996+
sk->sk_data_ready(sk, skb->len);
19941997
break;
19951998
}
19961999

@@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
20062009

20072010
/* put message back and return */
20082011
skb_queue_head(&sk->sk_receive_queue, skb);
2012+
sk->sk_data_ready(sk, skb->len);
20092013
break;
20102014
}
20112015
} while (size);

0 commit comments

Comments
 (0)