summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2017-10-19 16:42:04 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-21 12:27:05 +0100
commitcb4dc41eaad0cb336bb5ddd379ae0d2cc89cb62b (patch)
treed52c07e0c68976685188efcf5f384aed1184d297 /net/tipc
parent471abeabb416ad1f7c9f97227a5068ab5f6ffcde (diff)
downloadlinux-cb4dc41eaad0cb336bb5ddd379ae0d2cc89cb62b.tar.gz
linux-cb4dc41eaad0cb336bb5ddd379ae0d2cc89cb62b.tar.bz2
linux-cb4dc41eaad0cb336bb5ddd379ae0d2cc89cb62b.zip
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')
-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,
poll_table *wait)
{
struct sock *sk = sock->sk;
- struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
struct tipc_sock *tsk = tipc_sk(sk);
struct tipc_group *grp = tsk->group;
u32 revents = 0;
@@ -733,7 +732,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
/* fall thru' */
case TIPC_LISTEN:
case TIPC_CONNECTING:
- if (skb)
+ if (!skb_queue_empty(&sk->sk_receive_queue))
revents |= POLLIN | POLLRDNORM;
break;
case TIPC_OPEN:
@@ -742,7 +741,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
revents |= POLLOUT;
if (!tipc_sk_type_connectionless(sk))
break;
- if (!skb)
+ if (skb_queue_empty(&sk->sk_receive_queue))
break;
revents |= POLLIN | POLLRDNORM;
break;