summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhillip Potter <phil@philpotter.co.uk>2021-04-23 00:49:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 10:59:38 +0200
commit35385daa8db320d2d9664930c28e732578b0d7de (patch)
treec54200fdd426ac5b7c87a9cec7cf117abcedd6a3
parent5ee60aa4b25378d041bb72e771b32c88463e7458 (diff)
downloadlinux-stable-35385daa8db320d2d9664930c28e732578b0d7de.tar.gz
linux-stable-35385daa8db320d2d9664930c28e732578b0d7de.tar.bz2
linux-stable-35385daa8db320d2d9664930c28e732578b0d7de.zip
net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
[ Upstream commit d13f048dd40e8577260cd43faea8ec9b77520197 ] 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 <oliver.sang@intel.com> Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header") Suggested-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Phillip Potter <phil@philpotter.co.uk> Acked-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/geneve.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index ce6fecf421f8..8c458c8f57a3 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -839,7 +839,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
__be16 df;
int err;
- if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+ if (!pskb_inet_may_pull(skb))
return -EINVAL;
sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
@@ -885,7 +885,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
__be16 sport;
int err;
- if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
+ if (!pskb_inet_may_pull(skb))
return -EINVAL;
sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);