All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>,
	Phillip Potter <phil@philpotter.co.uk>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: geneve: modify IP header check in geneve6_xmit_skb
Date: Thu, 22 Apr 2021 19:18:49 +0200	[thread overview]
Message-ID: <YIGv+UOHIl8c/JVk@hog> (raw)
In-Reply-To: <CANn89iJSy82k+5b-vgSE-tD7hc8MhM6Niu=eY8sg-b7LbULouQ@mail.gmail.com>

2021-04-22, 18:52:10 +0200, Eric Dumazet wrote:
> On Thu, Apr 22, 2021 at 6:04 PM Sabrina Dubroca <sd@queasysnail.net> wrote:
> >
> > 2021-04-22, 02:39:42 +0200, Florian Westphal wrote:
> > > Phillip Potter <phil@philpotter.co.uk> wrote:
> > > > Modify the check in geneve6_xmit_skb to use the size of a struct iphdr
> > > > rather than struct ipv6hdr. This fixes two kernel selftest failures
> > > > introduced by commit 6628ddfec758
> > > > ("net: geneve: check skb is large enough for IPv4/IPv6 header"), without
> > > > diminishing the fix provided by that commit.
> > >
> > > What errors?
> > >
> > > > Reported-by: kernel test robot <oliver.sang@intel.com>
> > > > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > > > ---
> > > >  drivers/net/geneve.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> > > > index 42f31c681846..a57a5e6f614f 100644
> > > > --- a/drivers/net/geneve.c
> > > > +++ b/drivers/net/geneve.c
> > > > @@ -988,7 +988,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_network_may_pull(skb, sizeof(struct iphdr)))
> > > >             return -EINVAL;
> > >
> > > Seems this is papering over some bug, this change makes no sense to
> > > me.  Can you please explain this?
> >
> > I'm not sure the original commit (6628ddfec758 ("net: geneve: check
> > skb is large enough for IPv4/IPv6 header")) is correct either. GENEVE
> > isn't limited to carrying IP, I think an ethernet header with not much
> > else on top should be valid.
> 
> Maybe, but we still attempt to use ip_hdr() in this case, from
> geneve_get_v6_dst()
> 
> So there is something fishy.

In ip_tunnel_get_dsfield()? Only if there's IP in the packet. Other
tunnel types (except vxlan, which probably has the same problem as
geneve) ues pskb_inet_may_pull, that looks like what we need here as
well.

-- 
Sabrina


  reply	other threads:[~2021-04-22 17:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 23:11 [PATCH] net: geneve: modify IP header check in geneve6_xmit_skb Phillip Potter
2021-04-22  0:39 ` Florian Westphal
2021-04-22  0:56   ` Phillip Potter
2021-04-22 16:03   ` Sabrina Dubroca
2021-04-22 16:52     ` Eric Dumazet
2021-04-22 17:18       ` Sabrina Dubroca [this message]
2021-04-22 21:03         ` Phillip Potter
2021-04-22  6:43 ` Eric Dumazet
2021-04-22 20:58   ` Phillip Potter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIGv+UOHIl8c/JVk@hog \
    --to=sd@queasysnail.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=phil@philpotter.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.