* [net-next 1/1] tipc: fix broken tipc_poll() function
@ 2017-10-19 14:42 Jon Maloy
2017-10-21 11:27 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jon Maloy @ 2017-10-19 14:42 UTC (permalink / raw)
To: davem, netdev; +Cc: parthasarathy.bhuvaragan, ying.xue, tipc-discussion
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>
---
net/tipc/socket.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2bbab4f..357954c 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;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [net-next 1/1] tipc: fix broken tipc_poll() function
2017-10-19 14:42 [net-next 1/1] tipc: fix broken tipc_poll() function Jon Maloy
@ 2017-10-21 11:27 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-10-21 11:27 UTC (permalink / raw)
To: jon.maloy; +Cc: netdev, parthasarathy.bhuvaragan, ying.xue, tipc-discussion
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Thu, 19 Oct 2017 16:42:04 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [net-next 1/1] tipc: fix broken tipc_poll() function
@ 2017-10-19 13:25 Jon Maloy
0 siblings, 0 replies; 3+ messages in thread
From: Jon Maloy @ 2017-10-19 13:25 UTC (permalink / raw)
To: davem, netdev; +Cc: parthasarathy.bhuvaragan, ying.xue, tipc-discussion
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>
---
net/tipc/socket.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2bbab4f..4cb706a 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_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_empty(&sk->sk_receive_queue))
break;
revents |= POLLIN | POLLRDNORM;
break;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-21 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 14:42 [net-next 1/1] tipc: fix broken tipc_poll() function Jon Maloy
2017-10-21 11:27 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-10-19 13:25 Jon Maloy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.