diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2015-02-08 11:10:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-08 16:09:25 -0500 |
commit | 51a00daf7369b581e5241c5cae5924886deda261 (patch) | |
tree | a2dbbaa21bba03e86ac8bf58a7aedd4f5f2ddd2b /net/tipc | |
parent | 662f5533c40a97f02949ac81b1643538353c7e59 (diff) |
tipc: fix bug in socket reception function
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/socket.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 66666805b53c..4a98d15a1323 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, | |||
1802 | unsigned long time_limit = jiffies + 2; | 1802 | unsigned long time_limit = jiffies + 2; |
1803 | 1803 | ||
1804 | while (skb_queue_len(inputq)) { | 1804 | while (skb_queue_len(inputq)) { |
1805 | if (unlikely(time_after_eq(jiffies, time_limit))) | ||
1806 | return TIPC_OK; | ||
1805 | skb = tipc_skb_dequeue(inputq, dport); | 1807 | skb = tipc_skb_dequeue(inputq, dport); |
1806 | if (unlikely(!skb)) | 1808 | if (unlikely(!skb)) |
1807 | return TIPC_OK; | 1809 | return TIPC_OK; |
1808 | /* Return if softirq window exhausted */ | ||
1809 | if (unlikely(time_after_eq(jiffies, time_limit))) | ||
1810 | return TIPC_OK; | ||
1811 | if (!sock_owned_by_user(sk)) { | 1810 | if (!sock_owned_by_user(sk)) { |
1812 | err = filter_rcv(sk, &skb); | 1811 | err = filter_rcv(sk, &skb); |
1813 | if (likely(!skb)) | 1812 | if (likely(!skb)) |