Skip to content

Commit d13f048

Browse files
PhilPotterdavem330
authored andcommitted
net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes two kernel selftest failures introduced by the commit introducing the checks: IPv4 over geneve6: PMTU exceptions IPv4 over geneve6: PMTU exceptions - nexthop objects It does this by correctly accounting for the fact that IPv4 packets may transit over geneve IPv6 tunnels (and vice versa), and still fixes the uninit-value bug fixed by the original commit. Reported-by: kernel test robot <[email protected]> Fixes: 6628ddf ("net: geneve: check skb is large enough for IPv4/IPv6 header") Suggested-by: Sabrina Dubroca <[email protected]> Signed-off-by: Phillip Potter <[email protected]> Acked-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d742b5 commit d13f048

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/geneve.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
891891
__be16 sport;
892892
int err;
893893

894-
if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
894+
if (!pskb_inet_may_pull(skb))
895895
return -EINVAL;
896896

897897
sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
@@ -988,7 +988,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
988988
__be16 sport;
989989
int err;
990990

991-
if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
991+
if (!pskb_inet_may_pull(skb))
992992
return -EINVAL;
993993

994994
sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);

0 commit comments

Comments
 (0)