Commit 3d0241d5 authored by Alexey Kodanev's avatar Alexey Kodanev Committed by David S. Miller

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: 07b26c94 ("gso: Support partial splitting at the frag_list pointer")
Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a69518cf
...@@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, ...@@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
greh = (struct gre_base_hdr *)skb_transport_header(skb); greh = (struct gre_base_hdr *)skb_transport_header(skb);
pcsum = (__sum16 *)(greh + 1); pcsum = (__sum16 *)(greh + 1);
if (gso_partial) { if (gso_partial && skb_is_gso(skb)) {
unsigned int partial_adj; unsigned int partial_adj;
/* Adjust checksum to account for the fact that /* Adjust checksum to account for the fact that
......
...@@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, ...@@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
* will be using a length value equal to only one MSS sized * will be using a length value equal to only one MSS sized
* segment instead of the entire frame. * segment instead of the entire frame.
*/ */
if (gso_partial) { if (gso_partial && skb_is_gso(skb)) {
uh->len = htons(skb_shinfo(skb)->gso_size + uh->len = htons(skb_shinfo(skb)->gso_size +
SKB_GSO_CB(skb)->data_offset + SKB_GSO_CB(skb)->data_offset +
skb->head - (unsigned char *)uh); skb->head - (unsigned char *)uh);
......
...@@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, ...@@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
for (skb = segs; skb; skb = skb->next) { for (skb = segs; skb; skb = skb->next) {
ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff);
if (gso_partial) if (gso_partial && skb_is_gso(skb))
payload_len = skb_shinfo(skb)->gso_size + payload_len = skb_shinfo(skb)->gso_size +
SKB_GSO_CB(skb)->data_offset + SKB_GSO_CB(skb)->data_offset +
skb->head - (unsigned char *)(ipv6h + 1); skb->head - (unsigned char *)(ipv6h + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment