Skip to content

Commit 544aee5

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 79fd59a commit 544aee5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

net/ipv4/udp.c

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

811811
skb_shinfo(skb)->gso_size = cork->gso_size;
812812
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
813-
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh),
813+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
814814
cork->gso_size);
815815
goto csum_partial;
816816
}

net/ipv6/udp.c

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

10821082
skb_shinfo(skb)->gso_size = cork->gso_size;
10831083
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
1084+
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(*uh),
1085+
cork->gso_size);
10841086
goto csum_partial;
10851087
}
10861088

0 commit comments

Comments
 (0)