Skip to content

Commit

Permalink
ipc: Initialize ipc_namespace->user_ns early.
Browse files Browse the repository at this point in the history
Allow the ipc namespace initialization code to depend on ns->user_ns
being set during initialization.

In particular this allows mq_init_ns to use ns->user_ns for permission
checks and initializating s_user_ns while the the mq filesystem is
being mounted.

Acked-by: Seth Forshee <[email protected]>
Suggested-by: Seth Forshee <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Jun 23, 2016
1 parent 8654df4 commit b236017
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ipc/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
ns->ns.ops = &ipcns_operations;

atomic_set(&ns->count, 1);
ns->user_ns = get_user_ns(user_ns);

err = mq_init_ns(ns);
if (err) {
put_user_ns(ns->user_ns);
ns_free_inum(&ns->ns);
kfree(ns);
return ERR_PTR(err);
Expand All @@ -46,8 +49,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
msg_init_ns(ns);
shm_init_ns(ns);

ns->user_ns = get_user_ns(user_ns);

return ns;
}

Expand Down

0 comments on commit b236017

Please sign in to comment.