Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e71e474c784dc274f28ec8bb22a5dbabc6dc7c5 Commit: 4e71e474c784dc274f28ec8bb22a5dbabc6dc7c5 Parent: 6d79af701d334777541136e914a9c0969b2ad307 Author: Cedric Le Goater <[EMAIL PROTECTED]> AuthorDate: Sat Jun 23 17:16:25 2007 -0700 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Sun Jun 24 08:59:10 2007 -0700
fix refcounting of nsproxy object when unshared 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 <[EMAIL PROTECTED]> Cc: Badari Pulavarty <[EMAIL PROTECTED]> Cc: Herbert Poetzl <[EMAIL PROTECTED]> Cc: Oleg Nesterov <[EMAIL PROTECTED]> Cc: "Eric W. Biederman" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- kernel/nsproxy.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 1bc4b55..9e83b58 100644 --- a/kernel/nsproxy.c +++ b/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 long unshare_flags, 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; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html