diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2009-03-25 12:24:34 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-25 12:24:34 -0400 |
commit | 78f3648601fdc7a8166748bbd6d0555a88efa24a (patch) | |
tree | 6884aa56afe297f794b4bd926890a59eae6c259e | |
parent | a9a9adfe2f99ddadfb574a098392a007970a1577 (diff) |
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>
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 55befe59e1c0..54e983f13898 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1121,7 +1121,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp) | |||
1121 | struct nf_conntrack_tuple_hash, hnode); | 1121 | struct nf_conntrack_tuple_hash, hnode); |
1122 | hlist_del_rcu(&h->hnode); | 1122 | hlist_del_rcu(&h->hnode); |
1123 | bucket = __hash_conntrack(&h->tuple, hashsize, rnd); | 1123 | bucket = __hash_conntrack(&h->tuple, hashsize, rnd); |
1124 | hlist_add_head(&h->hnode, &hash[bucket]); | 1124 | hlist_add_head_rcu(&h->hnode, &hash[bucket]); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | old_size = nf_conntrack_htable_size; | 1127 | old_size = nf_conntrack_htable_size; |