Skip to content

Commit 3d0241d

Browse files
akodanevdavem330
authored andcommitted
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: 07b26c9 ("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>
1 parent a69518c commit 3d0241d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

net/ipv4/gre_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
8686
greh = (struct gre_base_hdr *)skb_transport_header(skb);
8787
pcsum = (__sum16 *)(greh + 1);
8888

89-
if (gso_partial) {
89+
if (gso_partial && skb_is_gso(skb)) {
9090
unsigned int partial_adj;
9191

9292
/* Adjust checksum to account for the fact that

net/ipv4/udp_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
120120
* will be using a length value equal to only one MSS sized
121121
* segment instead of the entire frame.
122122
*/
123-
if (gso_partial) {
123+
if (gso_partial && skb_is_gso(skb)) {
124124
uh->len = htons(skb_shinfo(skb)->gso_size +
125125
SKB_GSO_CB(skb)->data_offset +
126126
skb->head - (unsigned char *)uh);

net/ipv6/ip6_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
105105

106106
for (skb = segs; skb; skb = skb->next) {
107107
ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff);
108-
if (gso_partial)
108+
if (gso_partial && skb_is_gso(skb))
109109
payload_len = skb_shinfo(skb)->gso_size +
110110
SKB_GSO_CB(skb)->data_offset +
111111
skb->head - (unsigned char *)(ipv6h + 1);

0 commit comments

Comments
 (0)