netfilter: ipset: Add list flush to cancel_gc

[ Upstream commit c1193d9bbb ]

Flushing list in cancel_gc drops references to other lists right away,
without waiting for RCU to destroy list. Fixes race when referenced
ipsets can't be destroyed while referring list is scheduled for destroy.

Fixes: 97f7cf1cd8 ("netfilter: ipset: fix performance regression in swap operation")
Signed-off-by: Alexander Maltsev <keltar.gw@gmail.com>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Alexander Maltsev
2024-04-17 18:51:41 +05:00
committed by Greg Kroah-Hartman
parent 83a04f95f5
commit 8a326a2ef8
+3
View File
@@ -547,6 +547,9 @@ list_set_cancel_gc(struct ip_set *set)
if (SET_WITH_TIMEOUT(set))
del_timer_sync(&map->gc);
/* Flush list to drop references to other ipsets */
list_set_flush(set);
}
static const struct ip_set_type_variant set_variant = {