Re: [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 30, 2022 at 04:47:52PM +0200, Florian Westphal wrote:
> Guillaume Nault <gnault@xxxxxxxxxx> 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.




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux