Message ID | 20210615141736.509749-2-kleber.souza@canonical.com |
---|---|
State | New |
Headers | show |
Series | Fix broken IPv4 over geneve6 PMTU | expand |
On Tue, Jun 15, 2021 at 04:17:36PM +0200, Kleber Sacilotto de Souza wrote: > From: Phillip Potter <phil@philpotter.co.uk> > > BugLink: https://bugs.launchpad.net/bugs/1931731 > > 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> > (cherry picked from commit d13f048dd40e8577260cd43faea8ec9b77520197) > Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> > --- > drivers/net/geneve.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c > index c4beb7ce471a..40f30656a62a 100644 > --- a/drivers/net/geneve.c > +++ b/drivers/net/geneve.c > @@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, > __be16 sport; > 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); > @@ -957,7 +957,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); > -- > 2.27.0 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
On 15.06.21 16:17, Kleber Sacilotto de Souza wrote: > From: Phillip Potter <phil@philpotter.co.uk> > > BugLink: https://bugs.launchpad.net/bugs/1931731 > > 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> > (cherry picked from commit d13f048dd40e8577260cd43faea8ec9b77520197) > Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- > drivers/net/geneve.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c > index c4beb7ce471a..40f30656a62a 100644 > --- a/drivers/net/geneve.c > +++ b/drivers/net/geneve.c > @@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, > __be16 sport; > 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); > @@ -957,7 +957,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); >
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index c4beb7ce471a..40f30656a62a 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -891,7 +891,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be16 sport; 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); @@ -957,7 +957,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);