From be4d250ab41e13f8f945be6896695e870b38ba31 Mon Sep 17 00:00:00 2001 From: Xiaotian Feng Date: Fri, 25 Mar 2011 01:57:01 -0700 Subject: ipcns: fix use after free in free_ipc_ns() commit b515498 ("userns: add a user namespace owner of ipc ns") added a user namespace owner of ipc ns, but it also introduced a use after free in free_ipc_ns(). Signed-off-by: Xiaotian Feng Acked-by: "Serge E. Hallyn" Acked-by: David Howells Cc: "Eric W. Biederman" Cc: Daniel Lezcano Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- ipc/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/namespace.c b/ipc/namespace.c index 3c3e5223e7e5..8054c8e5faf1 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); } /* -- cgit v1.2.2