]> git.karo-electronics.de Git - karo-tx-linux.git/commit
netfilter: nf_conntrack: fix memory corruption with multiple namespaces
authorPatrick McHardy <kaber@trash.net>
Mon, 8 Feb 2010 19:16:26 +0000 (11:16 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Feb 2010 15:37:53 +0000 (07:37 -0800)
commitde2545859df3c04462ef39bf8056e587a1d2fa17
treeb9a1fb36584ec9aa6343bf883af7aa70afd6bf67
parentdc5b9893d10ba7132098e7ad991103430227724b
netfilter: nf_conntrack: fix memory corruption with multiple namespaces

commit 9edd7ca0a3e3999c260642c92fa008892d82ca6e upstream.

As discovered by Jon Masters <jonathan@jonmasters.org>, the "untracked"
conntrack, which is located in the data section, might be accidentally
freed when a new namespace is instantiated while the untracked conntrack
is attached to a skb because the reference count it re-initialized.

The best fix would be to use a seperate untracked conntrack per
namespace since it includes a namespace pointer. Unfortunately this is
not possible without larger changes since the namespace is not easily
available everywhere we need it. For now move the untracked conntrack
initialization to the init_net setup function to make sure the reference
count is not re-initialized and handle cleanup in the init_net cleanup
function to make sure namespaces can exit properly while the untracked
conntrack is in use in other namespaces.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/netfilter/nf_conntrack_core.c