aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2017-10-19 10:42:04 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-21 07:27:05 -0400
commitcb4dc41eaad0cb336bb5ddd379ae0d2cc89cb62b (patch)
treed52c07e0c68976685188efcf5f384aed1184d297 /net/tipc/socket.c
parent471abeabb416ad1f7c9f97227a5068ab5f6ffcde (diff)
tipc: fix broken tipc_poll() function
In commit ae236fb208a6 ("tipc: receive group membership events via member socket") we broke the tipc_poll() function by checking the state of the receive queue before the call to poll_sock_wait(), while relying that state afterwards, when it might have changed. We restore this in this commit. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2bbab4fe2f53..357954ceb25c 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -714,7 +714,6 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
714 poll_table *wait) 714 poll_table *wait)
715{ 715{
716 struct sock *sk = sock->sk; 716 struct sock *sk = sock->sk;
717 struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
718 struct tipc_sock *tsk = tipc_sk(sk); 717 struct tipc_sock *tsk = tipc_sk(sk);
719 struct tipc_group *grp = tsk->group; 718 struct tipc_group *grp = tsk->group;
720 u32 revents = 0; 719 u32 revents = 0;
@@ -733,7 +732,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
733 /* fall thru' */ 732 /* fall thru' */
734 case TIPC_LISTEN: 733 case TIPC_LISTEN:
735 case TIPC_CONNECTING: 734 case TIPC_CONNECTING:
736 if (skb) 735 if (!skb_queue_empty(&sk->sk_receive_queue))
737 revents |= POLLIN | POLLRDNORM; 736 revents |= POLLIN | POLLRDNORM;
738 break; 737 break;
739 case TIPC_OPEN: 738 case TIPC_OPEN:
@@ -742,7 +741,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
742 revents |= POLLOUT; 741 revents |= POLLOUT;
743 if (!tipc_sk_type_connectionless(sk)) 742 if (!tipc_sk_type_connectionless(sk))
744 break; 743 break;
745 if (!skb) 744 if (skb_queue_empty(&sk->sk_receive_queue))
746 break; 745 break;
747 revents |= POLLIN | POLLRDNORM; 746 revents |= POLLIN | POLLRDNORM;
748 break; 747 break;