Commit 59a08cba authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

tcp: fix lost_cnt_hint miscounts

It is possible that lost_cnt_hint gets underflow in
tcp_clean_rtx_queue because the cumulative ACK can cover
the segment where lost_skb_hint points to only partially,
which means that the hint is not cleared, opposite to what
my (earlier) comment claimed.

Also I don't agree what I ended up writing about non-trivial
case there to be what I intented to say. It was not supposed
to happen that the hint won't get cleared and we underflow
in any scenario.

In general, this is quite hard to trigger in practice.
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac11ba75
...@@ -3273,18 +3273,15 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, ...@@ -3273,18 +3273,15 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
if (tcp_is_reno(tp)) { if (tcp_is_reno(tp)) {
tcp_remove_reno_sacks(sk, pkts_acked); tcp_remove_reno_sacks(sk, pkts_acked);
} else { } else {
int delta;
/* Non-retransmitted hole got filled? That's reordering */ /* Non-retransmitted hole got filled? That's reordering */
if (reord < prior_fackets) if (reord < prior_fackets)
tcp_update_reordering(sk, tp->fackets_out - reord, 0); tcp_update_reordering(sk, tp->fackets_out - reord, 0);
/* No need to care for underflows here because delta = tcp_is_fack(tp) ? pkts_acked :
* the lost_skb_hint gets NULLed if we're past it prior_sacked - tp->sacked_out;
* (or something non-trivial happened) tp->lost_cnt_hint -= min(tp->lost_cnt_hint, delta);
*/
if (tcp_is_fack(tp))
tp->lost_cnt_hint -= pkts_acked;
else
tp->lost_cnt_hint -= prior_sacked - tp->sacked_out;
} }
tp->fackets_out -= min(pkts_acked, tp->fackets_out); tp->fackets_out -= min(pkts_acked, tp->fackets_out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment