aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Cardwell <ncardwell@google.com>2012-01-28 12:29:46 -0500
committerHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>2012-02-13 15:15:06 -0500
commitafab1dd58bbab20d2a14caec7d6869e35406708a (patch)
tree34108670aec304f8d32335d859f9b911d2ec0fab
parent32cdc817ad3b4c0a2a025312de5f68075e1bde8d (diff)
tcp: fix tcp_trim_head() to adjust segment count with skb MSS
BugLink: http://bugs.launchpad.net/bugs/926309 [ Upstream commit 5b35e1e6e9ca651e6b291c96d1106043c9af314a ] This commit fixes tcp_trim_head() to recalculate the number of segments in the skb with the skb's existing MSS, so trimming the head causes the skb segment count to be monotonically non-increasing - it should stay the same or go down, but not increase. Previously tcp_trim_head() used the current MSS of the connection. But if there was a decrease in MSS between original transmission and ACK (e.g. due to PMTUD), this could cause tcp_trim_head() to counter-intuitively increase the segment count when trimming bytes off the head of an skb. This violated assumptions in tcp_tso_acked() that tcp_trim_head() only decreases the packet count, so that packets_acked in tcp_tso_acked() could underflow, leading tcp_clean_rtx_queue() to pass u32 pkts_acked values as large as 0xffffffff to ca_ops->pkts_acked(). As an aside, if tcp_trim_head() had really wanted the skb to reflect the current MSS, it should have called tcp_set_skb_tso_segs() unconditionally, since a decrease in MSS would mean that a single-packet skb should now be sliced into multiple segments. Signed-off-by: Neal Cardwell <ncardwell@google.com> Acked-by: Nandita Dukkipati <nanditad@google.com> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
-rw-r--r--net/ipv4/tcp_output.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 882e0b0964d..faf257b9415 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1134,11 +1134,9 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
1134 sk_mem_uncharge(sk, len); 1134 sk_mem_uncharge(sk, len);
1135 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 1135 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
1136 1136
1137 /* Any change of skb->len requires recalculation of tso 1137 /* Any change of skb->len requires recalculation of tso factor. */
1138 * factor and mss.
1139 */
1140 if (tcp_skb_pcount(skb) > 1) 1138 if (tcp_skb_pcount(skb) > 1)
1141 tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk)); 1139 tcp_set_skb_tso_segs(sk, skb, tcp_skb_mss(skb));
1142 1140
1143 return 0; 1141 return 0;
1144} 1142}