* [PATCH net-next 1/1] tipc: fix bug in socket reception function
@ 2015-02-08 16:10 Jon Maloy
2015-02-08 21:09 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2015-02-08 16:10 UTC (permalink / raw)
To: davem
Cc: netdev, Paul Gortmaker, erik.hugne, ying.xue, maloy,
tipc-discussion, Jon Maloy
In commit c637c1035534867b85b78b453c38c495b58e2c5a ("tipc: resolve race
problem at unicast message reception") we introduced a time limit
for how long the function tipc_sk_eneque() would be allowed to execute
its loop. Unfortunately, the test for when this limit is passed was put
in the wrong place, resulting in a lost message when the test is true.
We fix this by moving the test to before we dequeue the next buffer
from the input queue.
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 6666680..4a98d15 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1802,12 +1802,11 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
unsigned long time_limit = jiffies + 2;
while (skb_queue_len(inputq)) {
+ if (unlikely(time_after_eq(jiffies, time_limit)))
+ return TIPC_OK;
skb = tipc_skb_dequeue(inputq, dport);
if (unlikely(!skb))
return TIPC_OK;
- /* Return if softirq window exhausted */
- if (unlikely(time_after_eq(jiffies, time_limit)))
- return TIPC_OK;
if (!sock_owned_by_user(sk)) {
err = filter_rcv(sk, &skb);
if (likely(!skb))
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next 1/1] tipc: fix bug in socket reception function
2015-02-08 16:10 [PATCH net-next 1/1] tipc: fix bug in socket reception function Jon Maloy
@ 2015-02-08 21:09 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-08 21:09 UTC (permalink / raw)
To: jon.maloy
Cc: netdev, paul.gortmaker, erik.hugne, ying.xue, maloy,
tipc-discussion
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Sun, 8 Feb 2015 11:10:50 -0500
> In commit c637c1035534867b85b78b453c38c495b58e2c5a ("tipc: resolve race
> problem at unicast message reception") we introduced a time limit
> for how long the function tipc_sk_eneque() would be allowed to execute
> its loop. Unfortunately, the test for when this limit is passed was put
> in the wrong place, resulting in a lost message when the test is true.
>
> We fix this by moving the test to before we dequeue the next buffer
> from the input queue.
>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Applied, thanks Jon.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-08 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-08 16:10 [PATCH net-next 1/1] tipc: fix bug in socket reception function Jon Maloy
2015-02-08 21:09 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).