From fb3b06b5c56efadd9b93b319ec9e1fa530fd1fb3 Mon Sep 17 00:00:00 2001 From: Brett Mastbergen Date: Thu, 9 Jan 2025 12:18:41 -0500 Subject: [PATCH] netfilter: nft_set_pipapo: skip inactive elements during set walk jira VULN-8904 cve CVE-2023-6817 commit-author Florian Westphal commit 317eb9685095678f2c9f5a8189de698c5354316a upstream-diff Additional newline because this kernel has not removed the nft_set_elem_expired call yet Otherwise set elements can be deactivated twice which will cause a crash. Reported-by: Xingyuan Mo Fixes: 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso (cherry picked from commit 317eb9685095678f2c9f5a8189de698c5354316a) Signed-off-by: Brett Mastbergen --- net/netfilter/nft_set_pipapo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c index 4b79df6ecf6c6..11e24f56bf805 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -1981,6 +1981,10 @@ static void nft_pipapo_walk(const struct nft_ctx *ctx, struct nft_set *set, goto cont; e = f->mt[r].e; + + if (!nft_set_elem_active(&e->ext, iter->genmask)) + goto cont; + if (nft_set_elem_expired(&e->ext)) goto cont;