summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Maltsev <keltar.gw@gmail.com>2024-04-17 18:51:41 +0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-11 12:36:02 +0200
commit4440ef0f583740136420915819887c20b0b9b622 (patch)
treee1cb997b2c595d7b008c82756df961c816572570
parent33e0f0e51e39f57cc6455977b5491888e3041ed6 (diff)
netfilter: ipset: Add list flush to cancel_gc
[ Upstream commit c1193d9bbbd379defe9be3c6de566de684de8a6f ] 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: 97f7cf1cd80e ("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>
-rw-r--r--net/netfilter/ipset/ip_set_list_set.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index e839c356bcb5..902ff2f3bc72 100644
--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -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 = {