linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipcns: fix use after free in free_ipc_ns
@ 2011-03-25  6:28 Xiaotian Feng
  0 siblings, 0 replies; only message in thread
From: Xiaotian Feng @ 2011-03-25  6:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Xiaotian Feng, Andrew Morton, Serge E. Hallyn, Eric W. Biederman,
	David Howells, Daniel Lezcano

commit b515498 add a user namespace owner of ipc ns, but it also
introduced a use after free in free_ipc_ns.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Serge E. Hallyn" <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>
---
 ipc/namespace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipc/namespace.c b/ipc/namespace.c
index 3c3e522..8054c8e 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -104,7 +104,6 @@ static void free_ipc_ns(struct ipc_namespace *ns)
 	sem_exit_ns(ns);
 	msg_exit_ns(ns);
 	shm_exit_ns(ns);
-	kfree(ns);
 	atomic_dec(&nr_ipc_ns);
 
 	/*
@@ -113,6 +112,7 @@ static void free_ipc_ns(struct ipc_namespace *ns)
 	 */
 	ipcns_notify(IPCNS_REMOVED);
 	put_user_ns(ns->user_ns);
+	kfree(ns);
 }
 
 /*
-- 
1.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-25  6:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25  6:28 [PATCH] ipcns: fix use after free in free_ipc_ns Xiaotian Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).