aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/namespace.c
diff options
context:
space:
mode:
authorXiaotian Feng <dfeng@redhat.com>2011-03-25 04:57:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-25 20:45:16 -0400
commitbe4d250ab41e13f8f945be6896695e870b38ba31 (patch)
treea4c47d13bbd91ba05870f457b8063829ca81134f /ipc/namespace.c
parentc03e3126e4f9535f4983d727f036440255c43c82 (diff)
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 <dfeng@redhat.com> Acked-by: "Serge E. Hallyn" <serge.hallyn@canonical.com> Acked-by: David Howells <dhowells@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/namespace.c')
-rw-r--r--ipc/namespace.c2
1 files changed, 1 insertions, 1 deletions
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)
104 sem_exit_ns(ns); 104 sem_exit_ns(ns);
105 msg_exit_ns(ns); 105 msg_exit_ns(ns);
106 shm_exit_ns(ns); 106 shm_exit_ns(ns);
107 kfree(ns);
108 atomic_dec(&nr_ipc_ns); 107 atomic_dec(&nr_ipc_ns);
109 108
110 /* 109 /*
@@ -113,6 +112,7 @@ static void free_ipc_ns(struct ipc_namespace *ns)
113 */ 112 */
114 ipcns_notify(IPCNS_REMOVED); 113 ipcns_notify(IPCNS_REMOVED);
115 put_user_ns(ns->user_ns); 114 put_user_ns(ns->user_ns);
115 kfree(ns);
116} 116}
117 117
118/* 118/*