Commit cb4dc41e authored by Jon Maloy's avatar Jon Maloy Committed by David S. Miller

tipc: fix broken tipc_poll() function

In commit ae236fb2 ("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: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 471abeab
...@@ -714,7 +714,6 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock, ...@@ -714,7 +714,6 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
poll_table *wait) poll_table *wait)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
struct tipc_sock *tsk = tipc_sk(sk); struct tipc_sock *tsk = tipc_sk(sk);
struct tipc_group *grp = tsk->group; struct tipc_group *grp = tsk->group;
u32 revents = 0; u32 revents = 0;
...@@ -733,7 +732,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock, ...@@ -733,7 +732,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
/* fall thru' */ /* fall thru' */
case TIPC_LISTEN: case TIPC_LISTEN:
case TIPC_CONNECTING: case TIPC_CONNECTING:
if (skb) if (!skb_queue_empty(&sk->sk_receive_queue))
revents |= POLLIN | POLLRDNORM; revents |= POLLIN | POLLRDNORM;
break; break;
case TIPC_OPEN: case TIPC_OPEN:
...@@ -742,7 +741,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock, ...@@ -742,7 +741,7 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock,
revents |= POLLOUT; revents |= POLLOUT;
if (!tipc_sk_type_connectionless(sk)) if (!tipc_sk_type_connectionless(sk))
break; break;
if (!skb) if (skb_queue_empty(&sk->sk_receive_queue))
break; break;
revents |= POLLIN | POLLRDNORM; revents |= POLLIN | POLLRDNORM;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment