diff options
author | Patrick McHardy <kaber@trash.net> | 2010-02-08 11:18:07 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-08 11:18:07 -0800 |
commit | d696c7bdaa55e2208e56c6f98e6bc1599f34286d (patch) | |
tree | 628782197c21b1e8611a41914865cdba586a1c65 /net/netfilter/nf_conntrack_expect.c | |
parent | 14c7dbe043d01a83a30633ab6b109ba2ac61d9f7 (diff) | |
download | op-kernel-dev-d696c7bdaa55e2208e56c6f98e6bc1599f34286d.zip op-kernel-dev-d696c7bdaa55e2208e56c6f98e6bc1599f34286d.tar.gz |
netfilter: nf_conntrack: fix hash resizing with namespaces
As noticed by Jon Masters <jonathan@jonmasters.org>, the conntrack hash
size is global and not per namespace, but modifiable at runtime through
/sys/module/nf_conntrack/hashsize. Changing the hash size will only
resize the hash in the current namespace however, so other namespaces
will use an invalid hash size. This can cause crashes when enlarging
the hashsize, or false negative lookups when shrinking it.
Move the hash size into the per-namespace data and only use the global
hash size to initialize the per-namespace value when instanciating a
new namespace. Additionally restrict hash resizing to init_net for
now as other namespaces are not handled currently.
Cc: stable@kernel.org
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_conntrack_expect.c')
-rw-r--r-- | net/netfilter/nf_conntrack_expect.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index 4ad7d1d..2f25ff6 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c @@ -577,7 +577,7 @@ int nf_conntrack_expect_init(struct net *net) if (net_eq(net, &init_net)) { if (!nf_ct_expect_hsize) { - nf_ct_expect_hsize = nf_conntrack_htable_size / 256; + nf_ct_expect_hsize = net->ct.htable_size / 256; if (!nf_ct_expect_hsize) nf_ct_expect_hsize = 1; } |