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>
This commit is contained in:
parent
c03e3126e4
commit
be4d250ab4
@ -104,7 +104,6 @@ static void free_ipc_ns(struct ipc_namespace *ns)
|
|||||||
sem_exit_ns(ns);
|
sem_exit_ns(ns);
|
||||||
msg_exit_ns(ns);
|
msg_exit_ns(ns);
|
||||||
shm_exit_ns(ns);
|
shm_exit_ns(ns);
|
||||||
kfree(ns);
|
|
||||||
atomic_dec(&nr_ipc_ns);
|
atomic_dec(&nr_ipc_ns);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -113,6 +112,7 @@ static void free_ipc_ns(struct ipc_namespace *ns)
|
|||||||
*/
|
*/
|
||||||
ipcns_notify(IPCNS_REMOVED);
|
ipcns_notify(IPCNS_REMOVED);
|
||||||
put_user_ns(ns->user_ns);
|
put_user_ns(ns->user_ns);
|
||||||
|
kfree(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user