[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220930150818.GC10057@localhost.localdomain>
Date: Fri, 30 Sep 2022 17:08:18 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Florian Westphal <fw@...len.de>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
netfilter-devel@...r.kernel.org, Phil Sutter <phil@....cc>
Subject: Re: [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF
devices
On Fri, Sep 30, 2022 at 04:47:52PM +0200, Florian Westphal wrote:
> Guillaume Nault <gnault@...hat.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.
Thanks, I didn't realise that.
> > Shouldn't we test dev in the 'else if' condition?
>
> We could do that in case it makes review easier.
Then if it's just to help reviewers, a small comment should be enough.
Powered by blists - more mailing lists