Skip to content
This repository was archived by the owner on May 2, 2024. It is now read-only.

Commit 88c64f9

Browse files
Paolo Abenigregkh
Paolo Abeni
authored andcommitted
net: datagram: fix unbounded loop in __skb_try_recv_datagram()
[ Upstream commit 0b91bce ] Christoph reported a stall while peeking datagram with an offset when busy polling is enabled. __skb_try_recv_datagram() uses as the loop termination condition 'queue empty'. When peeking, the socket queue can be not empty, even when no additional packets are received. Address the issue explicitly checking for receive queue changes, as currently done by __skb_wait_for_more_packets(). Fixes: 2b5cd0d ("net: Change return type of sk_busy_loop from bool to void") Reported-and-tested-by: Christoph Paasch <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e4ff39e commit 88c64f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: net/core/datagram.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned int flags,
279279
break;
280280

281281
sk_busy_loop(sk, flags & MSG_DONTWAIT);
282-
} while (!skb_queue_empty(&sk->sk_receive_queue));
282+
} while (sk->sk_receive_queue.prev != *last);
283283

284284
error = -EAGAIN;
285285

0 commit comments

Comments
 (0)