Skip to content

Commit b236017

Browse files
committed
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>
1 parent 8654df4 commit b236017

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎ipc/namespace.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
3434
ns->ns.ops = &ipcns_operations;
3535

3636
atomic_set(&ns->count, 1);
37+
ns->user_ns = get_user_ns(user_ns);
38+
3739
err = mq_init_ns(ns);
3840
if (err) {
41+
put_user_ns(ns->user_ns);
3942
ns_free_inum(&ns->ns);
4043
kfree(ns);
4144
return ERR_PTR(err);
@@ -46,8 +49,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
4649
msg_init_ns(ns);
4750
shm_init_ns(ns);
4851

49-
ns->user_ns = get_user_ns(user_ns);
50-
5152
return ns;
5253
}
5354

0 commit comments

Comments
 (0)