]> bbs.cooldavid.org Git - net-next-2.6.git/commit
netfilter: nf_conntrack: fix memory corruption with multiple namespaces
authorPatrick McHardy <kaber@trash.net>
Wed, 3 Feb 2010 11:58:06 +0000 (12:58 +0100)
committerPatrick McHardy <kaber@trash.net>
Wed, 3 Feb 2010 11:58:06 +0000 (12:58 +0100)
commit056ff3e3bd1563969a311697323ff929df94415c
treeed88f59dc16a5096edea653f178c597bcbbc5caa
parente578756c35859a459d78d8416195bc5f5ff897d0
netfilter: nf_conntrack: fix memory corruption with multiple namespaces

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>
net/netfilter/nf_conntrack_core.c