Skip to content

Commit

Permalink
tcp: fix off-by-one bug in RACK
Browse files Browse the repository at this point in the history
RACK should mark a packet lost when remaining wait time is zero.

Signed-off-by: Yuchung Cheng <[email protected]>
Reviewed-by: Neal Cardwell <[email protected]>
Reviewed-by: Priyaranjan Jha <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
yuchungcheng authored and davem330 committed Dec 8, 2017
1 parent cd1fc85 commit 428aec5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/ipv4/tcp_recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
*/
remaining = tp->rack.rtt_us + reo_wnd -
tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
if (remaining < 0) {
if (remaining <= 0) {
tcp_rack_mark_skb_lost(sk, skb);
list_del_init(&skb->tcp_tsorted_anchor);
} else {
/* Record maximum wait time (+1 to avoid 0) */
*reo_timeout = max_t(u32, *reo_timeout, 1 + remaining);
/* Record maximum wait time */
*reo_timeout = max_t(u32, *reo_timeout, remaining);
}
}
}
Expand Down

0 comments on commit 428aec5

Please sign in to comment.