mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
netfilter: ipset: Don't use test_bit() in lockless RCU readers in bitmap types
The pair of the patch "netfilter: ipset: Don't use test_bit() in lockless RCU readers in hash types" for the bitmap types. Fixes:02a3231b6d("netfilter: nf_conntrack_expect: store netns and zone in expectation") Fixes:b0da3905bb("netfilter: ipset: Bitmap types using the unified code base") Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
e4b4984e28
commit
1171192ac9
|
|
@ -165,6 +165,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
|
|||
ip_set_init_skbinfo(ext_skbinfo(x, set), ext);
|
||||
|
||||
/* Activate element */
|
||||
smp_mb__before_atomic();
|
||||
set_bit(e->id, map->members);
|
||||
set->elements++;
|
||||
|
||||
|
|
@ -219,7 +220,7 @@ mtype_list(const struct ip_set *set,
|
|||
cond_resched_rcu();
|
||||
id = cb->args[IPSET_CB_ARG0];
|
||||
x = get_ext(set, map, id);
|
||||
if (!test_bit(id, map->members) ||
|
||||
if (!test_bit_acquire(id, map->members) ||
|
||||
(SET_WITH_TIMEOUT(set) &&
|
||||
#ifdef IP_SET_BITMAP_STORED_TIMEOUT
|
||||
mtype_is_filled(x) &&
|
||||
|
|
@ -278,6 +279,7 @@ mtype_gc(struct timer_list *t)
|
|||
x = get_ext(set, map, id);
|
||||
if (ip_set_timeout_expired(ext_timeout(x, set))) {
|
||||
clear_bit(id, map->members);
|
||||
smp_mb__after_atomic();
|
||||
ip_set_ext_destroy(set, x);
|
||||
set->elements--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static int
|
|||
bitmap_ip_do_test(const struct bitmap_ip_adt_elem *e,
|
||||
struct bitmap_ip *map, size_t dsize)
|
||||
{
|
||||
return !!test_bit(e->id, map->members);
|
||||
return !!test_bit_acquire(e->id, map->members);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ bitmap_ipmac_do_test(const struct bitmap_ipmac_adt_elem *e,
|
|||
{
|
||||
const struct bitmap_ipmac_elem *elem;
|
||||
|
||||
if (!test_bit(e->id, map->members))
|
||||
if (!test_bit_acquire(e->id, map->members))
|
||||
return 0;
|
||||
elem = get_const_elem(map->extensions, e->id, dsize);
|
||||
if (e->add_mac && elem->filled == MAC_FILLED)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static int
|
|||
bitmap_port_do_test(const struct bitmap_port_adt_elem *e,
|
||||
const struct bitmap_port *map, size_t dsize)
|
||||
{
|
||||
return !!test_bit(e->id, map->members);
|
||||
return !!test_bit_acquire(e->id, map->members);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user