Skip to content

Commit b67985b

Browse files
edumazetkuba-moo
authored andcommitted
tcp: add missing tcp_skb_can_collapse() test in tcp_shift_skb_data()
tcp_shift_skb_data() might collapse three packets into a larger one. P_A, P_B, P_C -> P_ABC Historically, it used a single tcp_skb_can_collapse_to(P_A) call, because it was enough. In commit 8571248 ("tcp: coalesce/collapse must respect MPTCP extensions"), this call was replaced by a call to tcp_skb_can_collapse(P_A, P_B) But the now needed test over P_C has been missed. This probably broke MPTCP. Then later, commit 9b65b17 ("net: avoid double accounting for pure zerocopy skbs") added an extra condition to tcp_skb_can_collapse(), but the missing call from tcp_shift_skb_data() is also breaking TCP zerocopy, because P_A and P_C might have different skb_zcopy_pure() status. Fixes: 8571248 ("tcp: coalesce/collapse must respect MPTCP extensions") Fixes: 9b65b17 ("net: avoid double accounting for pure zerocopy skbs") Signed-off-by: Eric Dumazet <[email protected]> Cc: Mat Martineau <[email protected]> Cc: Talal Ahmad <[email protected]> Cc: Arjun Roy <[email protected]> Cc: Willem de Bruijn <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Acked-by: Paolo Abeni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 81eb8b0 commit b67985b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/tcp_input.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
16601660
(mss != tcp_skb_seglen(skb)))
16611661
goto out;
16621662

1663+
if (!tcp_skb_can_collapse(prev, skb))
1664+
goto out;
16631665
len = skb->len;
16641666
pcount = tcp_skb_pcount(skb);
16651667
if (tcp_skb_shift(prev, skb, pcount, len))

0 commit comments

Comments
 (0)