The patch titled fix refcounting of nsproxy object when unshared has been added to the -mm tree. Its filename is fix-refcounting-of-nsproxy-object-when-unshared.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: fix refcounting of nsproxy object when unshared From: Cedric Le Goater <clg@xxxxxxxxxx> When a namespace is unshared, a refcount on the previous nsproxy is abusively taken, leading to a memory leak of nsproxy objects. Signed-off-by: Cedric Le Goater <clg@xxxxxxxxxx> Cc: Badari Pulavarty <pbadari@xxxxxxxxxx> Cc: Herbert Poetzl <herbert@xxxxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/nsproxy.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff -puN kernel/nsproxy.c~fix-refcounting-of-nsproxy-object-when-unshared kernel/nsproxy.c --- a/kernel/nsproxy.c~fix-refcounting-of-nsproxy-object-when-unshared +++ a/kernel/nsproxy.c @@ -145,13 +145,11 @@ void free_nsproxy(struct nsproxy *ns) /* * Called from unshare. Unshare all the namespaces part of nsproxy. - * On sucess, returns the new nsproxy and a reference to old nsproxy - * to make sure it stays around. + * On success, returns the new nsproxy. */ int unshare_nsproxy_namespaces(unsigned long unshare_flags, struct nsproxy **new_nsp, struct fs_struct *new_fs) { - struct nsproxy *old_ns = current->nsproxy; int err = 0; if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC))) @@ -170,13 +168,9 @@ int unshare_nsproxy_namespaces(unsigned if (!capable(CAP_SYS_ADMIN)) return -EPERM; - get_nsproxy(old_ns); - *new_nsp = create_new_namespaces(unshare_flags, current, new_fs ? new_fs : current->fs); - if (IS_ERR(*new_nsp)) { + if (IS_ERR(*new_nsp)) err = PTR_ERR(*new_nsp); - put_nsproxy(old_ns); - } return err; } _ Patches currently in -mm which might be from clg@xxxxxxxxxx are fix-refcounting-of-nsproxy-object-when-unshared.patch mm-merge-nopfn-into-fault-spufs-fix.patch remove-config_uts_ns-and-config_ipc_ns.patch user-namespace-add-the-framework.patch user-namespace-add-unshare.patch mm-fix-create_new_namespaces-return-value.patch containersv10-add-tasks-file-interface-fix-2.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html