aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netns
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-02-08 14:16:56 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-08 14:16:56 -0500
commit5b3501faa8741d50617ce4191c20061c6ef36cb3 (patch)
treefd3ac41baea9db5d795144da48cef46aca3e01f6 /include/net/netns
parent9edd7ca0a3e3999c260642c92fa008892d82ca6e (diff)
netfilter: nf_conntrack: per netns nf_conntrack_cachep
nf_conntrack_cachep is currently shared by all netns instances, but because of SLAB_DESTROY_BY_RCU special semantics, this is wrong. If we use a shared slab cache, one object can instantly flight between one hash table (netns ONE) to another one (netns TWO), and concurrent reader (doing a lookup in netns ONE, 'finding' an object of netns TWO) can be fooled without notice, because no RCU grace period has to be observed between object freeing and its reuse. We dont have this problem with UDP/TCP slab caches because TCP/UDP hashtables are global to the machine (and each object has a pointer to its netns). If we use per netns conntrack hash tables, we also *must* use per netns conntrack slab caches, to guarantee an object can not escape from one namespace to another one. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> [Patrick: added unique slab name allocation] Cc: stable@kernel.org Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/net/netns')
-rw-r--r--include/net/netns/conntrack.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index ba1ba0c5efd1..aed23b6c8478 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -11,6 +11,7 @@ struct nf_conntrack_ecache;
11struct netns_ct { 11struct netns_ct {
12 atomic_t count; 12 atomic_t count;
13 unsigned int expect_count; 13 unsigned int expect_count;
14 struct kmem_cache *nf_conntrack_cachep;
14 struct hlist_nulls_head *hash; 15 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 16 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 17 struct hlist_nulls_head unconfirmed;
@@ -28,5 +29,6 @@ struct netns_ct {
28#endif 29#endif
29 int hash_vmalloc; 30 int hash_vmalloc;
30 int expect_vmalloc; 31 int expect_vmalloc;
32 char *slabname;
31}; 33};
32#endif 34#endif