Skip to content

Commit fba0b06

Browse files
joshhunt-akamaigregkh
authored andcommitted
udp: fix gso_segs calculations
[ Upstream commit 44b321e ] Commit dfec0ee ("udp: Record gso_segs when supporting UDP segmentation offload") added gso_segs calculation, but incorrectly got sizeof() the pointer and not the underlying data type. In addition let's fix the v6 case. Fixes: bec1f6f ("udp: generate gso with UDP_SEGMENT") Fixes: dfec0ee ("udp: Record gso_segs when supporting UDP segmentation offload") Signed-off-by: Josh Hunt <johunt@akamai.com> Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9af774b commit fba0b06

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

net/ipv4/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
868868

869869
skb_shinfo(skb)->gso_size = cork->gso_size;
870870
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
871-
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh),
871+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
872872
cork->gso_size);
873873
goto csum_partial;
874874
}

net/ipv6/udp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,8 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
11561156

11571157
skb_shinfo(skb)->gso_size = cork->gso_size;
11581158
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
1159+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
1160+
cork->gso_size);
11591161
goto csum_partial;
11601162
}
11611163

0 commit comments

Comments
 (0)