All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nft_set_pipapo: fix null deref for empty set
@ 2025-08-11 10:31 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2025-08-11 10:31 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

Blamed commit broke the check for a null scratch map:
  -  if (unlikely(!m || !*raw_cpu_ptr(m->scratch)))
  +  if (unlikely(!raw_cpu_ptr(m->scratch)))

This should have been "if (!*raw_ ...)".
Use the pattern of the avx2 version which is more readable.

This can only be reproduced if avx2 support isn't available.

Fixes: d8d871a35ca9 ("netfilter: nft_set_pipapo: merge pipapo_get/lookup")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nft_set_pipapo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 1a19649c2851..601dd5ed0e0c 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -426,10 +426,9 @@ static struct nft_pipapo_elem *pipapo_get(const struct nft_pipapo_match *m,
 
 	local_bh_disable();
 
-	if (unlikely(!raw_cpu_ptr(m->scratch)))
-		goto out;
-
 	scratch = *raw_cpu_ptr(m->scratch);
+	if (!scratch)
+		goto out;
 
 	map_index = scratch->map_index;
 
-- 
2.49.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-11 10:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 10:31 [PATCH nf] netfilter: nft_set_pipapo: fix null deref for empty set Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.