]> git.itanic.dy.fi Git - linux-stable/commitdiff
netfilter: nft_set_pipapo: skip inactive elements during set walk
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Dec 2023 14:47:13 +0000 (15:47 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 6 Dec 2023 16:14:37 +0000 (17:14 +0100)
Otherwise set elements can be deactivated twice which will cause a crash.

Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_set_pipapo.c

index 701977af3ee851947dbf3096e729f3161928b9d6..7252fcdae34993835d10d143c02755958ad9a7e2 100644 (file)
@@ -2043,6 +2043,9 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set,
 
                e = f->mt[r].e;
 
+               if (!nft_set_elem_active(&e->ext, iter->genmask))
+                       goto cont;
+
                iter->err = iter->fn(ctx, set, iter, &e->priv);
                if (iter->err < 0)
                        goto out;