Commit 04e5427dbe91e600cf5c03e7e97095ce3865af92

Authored by Herbert Xu
Committed by Greg Kroah-Hartman
1 parent f3721ea3af

tcp: Do not apply TSO segment limit to non-TSO packets

[ Upstream commit 843925f33fcc293d80acf2c5c8a78adf3344d49b ]

Thomas Jarosch reported IPsec TCP stalls when a PMTU event occurs.

In fact the problem was completely unrelated to IPsec.  The bug is
also reproducible if you just disable TSO/GSO.

The problem is that when the MSS goes down, existing queued packet
on the TX queue that have not been transmitted yet all look like
TSO packets and get treated as such.

This then triggers a bug where tcp_mss_split_point tells us to
generate a zero-sized packet on the TX queue.  Once that happens
we're screwed because the zero-sized packet can never be removed
by ACKs.

Fixes: 1485348d242 ("tcp: Apply device TSO segment limit earlier")
Reported-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

net/ipv4/tcp_output.c
... ... @@ -1984,7 +1984,7 @@
1984 1984 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
1985 1985 break;
1986 1986  
1987   - if (tso_segs == 1) {
  1987 + if (tso_segs == 1 || !sk->sk_gso_max_segs) {
1988 1988 if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
1989 1989 (tcp_skb_is_last(sk, skb) ?
1990 1990 nonagle : TCP_NAGLE_PUSH))))
... ... @@ -2020,7 +2020,7 @@
2020 2020 }
2021 2021  
2022 2022 limit = mss_now;
2023   - if (tso_segs > 1 && !tcp_urg_mode(tp))
  2023 + if (tso_segs > 1 && sk->sk_gso_max_segs && !tcp_urg_mode(tp))
2024 2024 limit = tcp_mss_split_point(sk, skb, mss_now,
2025 2025 min_t(unsigned int,
2026 2026 cwnd_quota,