From: Alexander Maltsev Date: Wed, 17 Apr 2024 13:51:41 +0000 (+0500) Subject: netfilter: ipset: Add list flush to cancel_gc X-Git-Tag: archive/raspbian/5.10.223-1+rpi1^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aa56e0ee8db20dba1e4e7ac54a8c4bd1d809e626;p=linux.git netfilter: ipset: Add list flush to cancel_gc Origin: https://git.kernel.org/linus/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 Acked-by: Jozsef Kadlecsik Signed-off-by: Pablo Neira Ayuso Gbp-Pq: Topic bugfix/all Gbp-Pq: Name netfilter-ipset-Add-list-flush-to-cancel_gc.patch --- diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c index e839c356bcb..902ff2f3bc7 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 = {