Skip to content

Commit b451e5d

Browse files
yuchungchengdavem330
authored andcommitted
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. Fixes: adb92db ("tcp: Make SACK code to split only at mss boundaries") Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f6ba8d3 commit b451e5d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

net/ipv4/tcp_input.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,13 +1179,14 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,
11791179
*/
11801180
if (pkt_len > mss) {
11811181
unsigned int new_len = (pkt_len / mss) * mss;
1182-
if (!in_sack && new_len < pkt_len) {
1182+
if (!in_sack && new_len < pkt_len)
11831183
new_len += mss;
1184-
if (new_len >= skb->len)
1185-
return 0;
1186-
}
11871184
pkt_len = new_len;
11881185
}
1186+
1187+
if (pkt_len >= skb->len && !in_sack)
1188+
return 0;
1189+
11891190
err = tcp_fragment(sk, skb, pkt_len, mss, GFP_ATOMIC);
11901191
if (err < 0)
11911192
return err;

0 commit comments

Comments
 (0)