Linux Netfilter development
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: ipset: fix list type element drift bug
@ 2026-08-06 13:53 Florian Westphal
  2026-08-06 16:51 ` Florian Westphal
  2026-08-09 12:58 ` Jozsef Kadlecsik
  0 siblings, 2 replies; 6+ messages in thread
From: Florian Westphal @ 2026-08-06 13:53 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Jozsef Kadlecsik, Florian Westphal

If list_set_uadd() calls list_set_replace() to swap an expired entry,
the element count remains the same, therefore the increment must be elided.

Fixes: 702b71e7c666 ("netfilter: ipset: Add element count to all set types header")
Link: https://sashiko.dev/#/patchset/20260806101947.2802-1-fw%40strlen.de
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/ipset/ip_set_list_set.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index ca3ef9479e83..56626f4943a9 100644
--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -301,8 +301,11 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext,
 	e->set = set;
 	INIT_LIST_HEAD(&e->list);
 	list_set_init_extensions(set, ext, e);
-	if (n)
+	if (n) {
 		list_set_replace(set, e, n);
+		return 0;
+	}
+
 	else if (next)
 		list_add_tail_rcu(&e->list, &next->list);
 	else if (prev)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-10 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 13:53 [PATCH nf] netfilter: ipset: fix list type element drift bug Florian Westphal
2026-08-06 16:51 ` Florian Westphal
2026-08-09 13:23   ` Jozsef Kadlecsik
2026-08-09 12:58 ` Jozsef Kadlecsik
2026-08-09 14:16   ` Florian Westphal
2026-08-10 13:04     ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox