[PATCH] nsproxy cloning error path fix
authorPavel <xemul@openvz.org>
Mon, 2 Oct 2006 09:18:24 +0000 (02:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 2 Oct 2006 14:57:22 +0000 (07:57 -0700)
This patch fixes copy_namespaces()'s error path.

when new nsproxy (new_ns) is created pointers to namespaces (ipc, uts) are
copied from the old nsproxy.  Later in copy_utsname, copy_ipcs, etc.
according namespaces are get-ed.  On error path needed namespaces are
put-ed, so there's no need to put new nsproxy itelf as it woud cause
putting namespaces for the second time.

Found when incorporating namespaces into OpenVZ kernel.

Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/nsproxy.c

index 8d6c852dc51ea76ffaf023f7452ced9794ffc5f4..6ebdb82a0ce43a5211e3862008959cb5091febcd 100644 (file)
@@ -123,7 +123,7 @@ out_uts:
                put_namespace(new_ns->namespace);
 out_ns:
        tsk->nsproxy = old_ns;
-       put_nsproxy(new_ns);
+       kfree(new_ns);
        goto out;
 }