summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-05-31 13:26:41 -0400
committerEric W. Biederman <ebiederm@xmission.com>2016-06-23 16:41:53 -0400
commitb236017acffa73d52eac9427f42d8993067d20fb (patch)
tree02dd39ff4a5e38f15f6f708a46d8034a23ebb0d8 /ipc
parent8654df4e2ac9704905198d63845554c2ddf6a93f (diff)
ipc: Initialize ipc_namespace->user_ns early.
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 <seth.forshee@canonical.com> Suggested-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/namespace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 068caf18d565..04cb07eb81f1 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -34,8 +34,11 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
34 ns->ns.ops = &ipcns_operations; 34 ns->ns.ops = &ipcns_operations;
35 35
36 atomic_set(&ns->count, 1); 36 atomic_set(&ns->count, 1);
37 ns->user_ns = get_user_ns(user_ns);
38
37 err = mq_init_ns(ns); 39 err = mq_init_ns(ns);
38 if (err) { 40 if (err) {
41 put_user_ns(ns->user_ns);
39 ns_free_inum(&ns->ns); 42 ns_free_inum(&ns->ns);
40 kfree(ns); 43 kfree(ns);
41 return ERR_PTR(err); 44 return ERR_PTR(err);
@@ -46,8 +49,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
46 msg_init_ns(ns); 49 msg_init_ns(ns);
47 shm_init_ns(ns); 50 shm_init_ns(ns);
48 51
49 ns->user_ns = get_user_ns(user_ns);
50
51 return ns; 52 return ns;
52} 53}
53 54