tcp: avoid fragmenting peculiar skbs in SACK
Subsystems (3)
PATCH 1/1 tcp: avoid fragmenting peculiar skbs in SACK
This patch fixes a bug in splitting an SKB during SACK processing. Specifically if an skb contains multiple packets and is only partially sacked in the higher sequences, tcp_match_sack_to_skb() splits the skb and marks the second fragment as SACKed.
The current code further attempts rounding up the first fragment to MSS boundaries. But it misses a boundary condition when the rounded-up fragment size (pkt_len) is exactly skb size. Spliting such an skb is pointless and causses a kernel warning and aborts the SACK processing. This patch universally checks such over-split before calling tcp_fragment to prevent these unnecessary warnings.
--- net/ipv4/tcp_input.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ipv4/tcp_input.c +5 -4
@@ -1179,13 +1179,14 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,*/ if (pkt_len > mss) {unsigned int new_len = (pkt_len / mss) * mss; -if (!in_sack && new_len < pkt_len) { +if (!in_sack && new_len < pkt_len) new_len += mss; -if (new_len >= skb->len) -return 0 ; - } pkt_len = new_len; } + +if (pkt_len >= skb->len && !in_sack) +return 0 ; + err =tcp_fragment (sk, skb, pkt_len, mss,GFP_ATOMIC );if (err <0 )return err;
Signature · 1 line
2.13.0.rc2.291.g57267f2277-goog
Quoted 14 lines · Yuchung Cheng
This patch fixes a bug in splitting an SKB during SACK processing. Specifically if an skb contains multiple packets and is only partially sacked in the higher sequences,
tcp_match_sack_to_skb()splits the skb and marks the second fragment as SACKed.The current code further attempts rounding up the first fragment to MSS boundaries. But it misses a boundary condition when the rounded-up fragment size (
pkt_len) is exactly skb size. Spliting such an skb is pointless and causses a kernel warning and aborts the SACK processing. This patch universally checks such over-split before callingtcp_fragmentto prevent these unnecessary warnings.
Quoted 4 lines
Fixes adb92db857ee ("tcp: Make SACK code to split only at mss boundaries")Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by Soheil Hassas Yeganeh <[email protected]>
neal
David Miller
maintainerFrom: Yuchung Cheng <[email protected]>
Date: Wed, 10 May 2017 17:01:27 -0700
Quoted 13 lines
This patch fixes a bug in splitting an SKB during SACK processing. Specifically if an skb contains multiple packets and is only partially sacked in the higher sequences,
tcp_match_sack_to_skb()splits the skb and marks the second fragment as SACKed.The current code further attempts rounding up the first fragment to MSS boundaries. But it misses a boundary condition when the rounded-up fragment size (
pkt_len) is exactly skb size. Spliting such an skb is pointless and causses a kernel warning and aborts the SACK processing. This patch universally checks such over-split before callingtcp_fragmentto prevent these unnecessary warnings.
Quoted 4 lines
Fixes adb92db857ee ("tcp: Make SACK code to split only at mss boundaries")Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by Soheil Hassas Yeganeh <[email protected]>
Hehe, a 2.6.29 bug, funny that it lived for so long.
Applied and queued up for -stable, thanks!