Skip to content

Commit cec8ebb

Browse files
PhilPotterksacilotto
authored andcommitted
net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
BugLink: https://bugs.launchpad.net/bugs/1929615 [ Upstream commit d13f048 ] 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]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
1 parent 5970179 commit cec8ebb

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);
@@ -957,7 +957,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
957957
__be16 sport;
958958
int err;
959959

960-
if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
960+
if (!pskb_inet_may_pull(skb))
961961
return -EINVAL;
962962

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

0 commit comments

Comments
 (0)