netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Guillaume Nault <gnault@redhat.com>
Cc: Florian Westphal <fw@strlen.de>,
	netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	netfilter-devel@vger.kernel.org, Phil Sutter <phil@nwl.cc>
Subject: Re: [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices
Date: Fri, 30 Sep 2022 16:47:52 +0200	[thread overview]
Message-ID: <20220930144752.GA8349@breakpoint.cc> (raw)
In-Reply-To: <20220930141048.GA10057@localhost.localdomain>

Guillaume Nault <gnault@redhat.com> wrote:
> On Wed, Sep 28, 2022 at 01:39:08PM +0200, Florian Westphal wrote:
> > diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c
> > index 8970d0b4faeb..1d7e520d9966 100644
> > --- a/net/ipv6/netfilter/nft_fib_ipv6.c
> > +++ b/net/ipv6/netfilter/nft_fib_ipv6.c
> > @@ -41,6 +41,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,
> >  	if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) {
> >  		lookup_flags |= RT6_LOOKUP_F_IFACE;
> >  		fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev);
> > +	} else if ((priv->flags & NFTA_FIB_F_IIF) &&
> > +		   (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) {
> > +		fl6->flowi6_oif = dev->ifindex;
> >  	}
> 
> I'm not very familiar with nft code, but it seems dev can be NULL here,
> so netif_is_l3_master() can dereference a NULL pointer.

No, this should never be NULL, NFTA_FIB_F_IIF is restricted to
input/prerouting chains.

> Shouldn't we test dev in the 'else if' condition?

We could do that in case it makes review easier.

  reply	other threads:[~2022-09-30 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 11:39 [PATCH net-next 0/1] netfilter fix for net-next Florian Westphal
2022-09-28 11:39 ` [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices Florian Westphal
2022-09-28 17:40   ` patchwork-bot+netdevbpf
2022-09-29 16:10   ` Guillaume Nault
2022-09-29 16:21     ` Florian Westphal
2022-09-29 17:54       ` David Ahern
2022-09-30 14:10   ` Guillaume Nault
2022-09-30 14:47     ` Florian Westphal [this message]
2022-09-30 15:08       ` Guillaume Nault

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=20220930144752.GA8349@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gnault@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@nwl.cc \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).