1
0
Fork 0

netfilter: nf_conntrack: use hlist_add_head_rcu() in nf_conntrack_set_hashsize()

Using hlist_add_head() in nf_conntrack_set_hashsize() is quite dangerous.
Without any barrier, one CPU could see a loop while doing its lookup.
Its true new table cannot be seen by another cpu, but previous table is still
readable.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
hifive-unleashed-5.1
Eric Dumazet 2009-03-25 17:24:34 +01:00 committed by Patrick McHardy
parent a9a9adfe2f
commit 78f3648601
1 changed files with 1 additions and 1 deletions

View File

@ -1121,7 +1121,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
struct nf_conntrack_tuple_hash, hnode);
hlist_del_rcu(&h->hnode);
bucket = __hash_conntrack(&h->tuple, hashsize, rnd);
hlist_add_head(&h->hnode, &hash[bucket]);
hlist_add_head_rcu(&h->hnode, &hash[bucket]);
}
}
old_size = nf_conntrack_htable_size;