diff options
author | Alexey Kodanev <alexey.kodanev@oracle.com> | 2017-10-06 12:02:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-08 13:12:15 -0400 |
commit | 3d0241d57c7b25bb75ac9d7a62753642264fdbce (patch) | |
tree | 536ca01291bd131be75fed6742557d1885774622 /net | |
parent | a69518cf0b4cbf02c6bc1239cdeb8750a9eb8077 (diff) |
gso: fix payload length when gso_size is zero
When gso_size reset to zero for the tail segment in skb_segment(), later
in ipv6_gso_segment(), __skb_udp_tunnel_segment() and gre_gso_segment()
we will get incorrect results (payload length, pcsum) for that segment.
inet_gso_segment() already has a check for gso_size before calculating
payload.
The issue was found with LTP vxlan & gre tests over ixgbe NIC.
Fixes: 07b26c9454a2 ("gso: Support partial splitting at the frag_list pointer")
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/gre_offload.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp_offload.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_offload.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index 416bb304a281..1859c473b21a 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c | |||
@@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, | |||
86 | greh = (struct gre_base_hdr *)skb_transport_header(skb); | 86 | greh = (struct gre_base_hdr *)skb_transport_header(skb); |
87 | pcsum = (__sum16 *)(greh + 1); | 87 | pcsum = (__sum16 *)(greh + 1); |
88 | 88 | ||
89 | if (gso_partial) { | 89 | if (gso_partial && skb_is_gso(skb)) { |
90 | unsigned int partial_adj; | 90 | unsigned int partial_adj; |
91 | 91 | ||
92 | /* Adjust checksum to account for the fact that | 92 | /* Adjust checksum to account for the fact that |
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 97658bfc1b58..e360d55be555 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c | |||
@@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, | |||
120 | * will be using a length value equal to only one MSS sized | 120 | * will be using a length value equal to only one MSS sized |
121 | * segment instead of the entire frame. | 121 | * segment instead of the entire frame. |
122 | */ | 122 | */ |
123 | if (gso_partial) { | 123 | if (gso_partial && skb_is_gso(skb)) { |
124 | uh->len = htons(skb_shinfo(skb)->gso_size + | 124 | uh->len = htons(skb_shinfo(skb)->gso_size + |
125 | SKB_GSO_CB(skb)->data_offset + | 125 | SKB_GSO_CB(skb)->data_offset + |
126 | skb->head - (unsigned char *)uh); | 126 | skb->head - (unsigned char *)uh); |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index cdb3728faca7..4a87f9428ca5 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
105 | 105 | ||
106 | for (skb = segs; skb; skb = skb->next) { | 106 | for (skb = segs; skb; skb = skb->next) { |
107 | ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); | 107 | ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); |
108 | if (gso_partial) | 108 | if (gso_partial && skb_is_gso(skb)) |
109 | payload_len = skb_shinfo(skb)->gso_size + | 109 | payload_len = skb_shinfo(skb)->gso_size + |
110 | SKB_GSO_CB(skb)->data_offset + | 110 | SKB_GSO_CB(skb)->data_offset + |
111 | skb->head - (unsigned char *)(ipv6h + 1); | 111 | skb->head - (unsigned char *)(ipv6h + 1); |