Skip to content

Commit

Permalink
[TCP]: Catch skb with S+L bugs earlier
Browse files Browse the repository at this point in the history
SACKED_ACKED and LOST are mutually exclusive with SACK, thus
having their sum larger than packets_out is bug with SACK.
Eventually these bugs trigger traps in the tcp_clean_rtx_queue
with SACK but it's much more informative to do this here.

Non-SACK TCP, however, could get more than packets_out duplicate
ACKs which each increment sacked_out, so it makes sense to do
this kind of limitting for non-SACK TCP but not for SACK enabled
one. Perhaps the author had the opposite in mind but did the
logic accidently wrong way around? Anyway, the sacked_out
incrementer code for non-SACK already deals this issue before
calling sync_left_out so this trapping can be done
unconditionally.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ij1 authored and davem330 committed Apr 30, 2007
1 parent 6aaf47f commit 34588b4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)

static inline void tcp_sync_left_out(struct tcp_sock *tp)
{
if (tp->rx_opt.sack_ok &&
(tp->sacked_out >= tp->packets_out - tp->lost_out))
tp->sacked_out = tp->packets_out - tp->lost_out;
BUG_ON(tp->sacked_out + tp->lost_out > tp->packets_out);
tp->left_out = tp->sacked_out + tp->lost_out;
}

Expand Down

0 comments on commit 34588b4

Please sign in to comment.