Skip to content

Commit

Permalink
[TCP]: Fix two off-by-one errors in fackets_out adjusting logic
Browse files Browse the repository at this point in the history
1) Passing wrong skb to tcp_adjust_fackets_out could corrupt
fastpath_cnt_hint as tcp_skb_pcount(next_skb) is not included
to it if hint points exactly to the next_skb (it's lagging
behind, see sacktag).

2) When fastpath_skb_hint is put backwards to avoid dangling
skb reference, the skb's pcount must also be removed from count
(not included like above).

Reported by Cedric Le Goater <legoater@free.fr>

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ilpo Järvinen authored and David S. Miller committed Oct 10, 2007
1 parent 182f6ed commit 29d0a30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1755,14 +1755,16 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
if (tcp_is_reno(tp) && tp->sacked_out)
tcp_dec_pcount_approx(&tp->sacked_out, next_skb);

tcp_adjust_fackets_out(tp, skb, tcp_skb_pcount(next_skb));
tcp_adjust_fackets_out(tp, next_skb, tcp_skb_pcount(next_skb));
tp->packets_out -= tcp_skb_pcount(next_skb);

/* changed transmit queue under us so clear hints */
tcp_clear_retrans_hints_partial(tp);
/* manually tune sacktag skb hint */
if (tp->fastpath_skb_hint == next_skb)
if (tp->fastpath_skb_hint == next_skb) {
tp->fastpath_skb_hint = skb;
tp->fastpath_cnt_hint -= tcp_skb_pcount(skb);
}

sk_stream_free_skb(sk, next_skb);
}
Expand Down

0 comments on commit 29d0a30

Please sign in to comment.