mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 19:13:03 -04:00
netfilter: ipset: let destroy callbacks adjust ext mem size
For bitmap this change makes no difference, because destructors are
called synchronously.
List type however calls them via call_rcu() so accounting decrement can
happen after list_set_flush() set ext_size to 0.
'set->elements = 0' can be removed for the same reason in the list type
case, it calls 'set->elements--' for each element.
Fixes: 9e41f26a50 ("netfilter: ipset: Count non-static extension memory for userspace")
Suggested-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
4cbd69766b
commit
490937b88c
@@ -77,7 +77,7 @@ mtype_flush(struct ip_set *set)
|
||||
mtype_ext_cleanup(set);
|
||||
bitmap_zero(map->members, map->elements);
|
||||
set->elements = 0;
|
||||
atomic64_set(&set->ext_size, 0);
|
||||
DEBUG_NET_WARN_ON_ONCE(atomic64_read(&set->ext_size) > 0);
|
||||
}
|
||||
|
||||
/* Calculate the actual memory size of the set data */
|
||||
|
||||
@@ -423,8 +423,7 @@ list_set_flush(struct ip_set *set)
|
||||
|
||||
list_for_each_entry_safe(e, n, &map->members, list)
|
||||
list_set_del(set, e);
|
||||
set->elements = 0;
|
||||
atomic64_set(&set->ext_size, 0);
|
||||
DEBUG_NET_WARN_ON_ONCE(set->elements > 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user