Skip to content

Commit

Permalink
tipc: fix bug in socket reception function
Browse files Browse the repository at this point in the history
In commit c637c10 ("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>
  • Loading branch information
Jon Paul Maloy authored and David S. Miller committed Feb 8, 2015
1 parent 662f553 commit 51a00da
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 51a00da

Please sign in to comment.