Re: [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices
From: Guillaume Nault <hidden>
Date: 2022-09-30 14:11:57
Also in:
netfilter-devel
From: Guillaume Nault <hidden>
Date: 2022-09-30 14:11:57
Also in:
netfilter-devel
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. Shouldn't we test dev in the 'else if' condition?