From: Xiaotian Feng Date: Fri, 25 Mar 2011 08:57:01 +0000 (-0700) Subject: ipcns: fix use after free in free_ipc_ns() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=be4d250ab41e13f8f945be6896695e870b38ba31;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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); } /*