diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/msgutil.c | 1 | ||||
-rw-r--r-- | ipc/namespace.c | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index f095ee268833..8b5ce5d3f3ef 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
@@ -32,6 +32,7 @@ struct ipc_namespace init_ipc_ns = { | |||
32 | .mq_msg_max = DFLT_MSGMAX, | 32 | .mq_msg_max = DFLT_MSGMAX, |
33 | .mq_msgsize_max = DFLT_MSGSIZEMAX, | 33 | .mq_msgsize_max = DFLT_MSGSIZEMAX, |
34 | #endif | 34 | #endif |
35 | .user_ns = &init_user_ns, | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | atomic_t nr_ipc_ns = ATOMIC_INIT(1); | 38 | atomic_t nr_ipc_ns = ATOMIC_INIT(1); |
diff --git a/ipc/namespace.c b/ipc/namespace.c index a1094ff0befa..aa1889962693 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
@@ -11,10 +11,11 @@ | |||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/mount.h> | 13 | #include <linux/mount.h> |
14 | #include <linux/user_namespace.h> | ||
14 | 15 | ||
15 | #include "util.h" | 16 | #include "util.h" |
16 | 17 | ||
17 | static struct ipc_namespace *create_ipc_ns(void) | 18 | static struct ipc_namespace *create_ipc_ns(struct ipc_namespace *old_ns) |
18 | { | 19 | { |
19 | struct ipc_namespace *ns; | 20 | struct ipc_namespace *ns; |
20 | int err; | 21 | int err; |
@@ -43,6 +44,9 @@ static struct ipc_namespace *create_ipc_ns(void) | |||
43 | ipcns_notify(IPCNS_CREATED); | 44 | ipcns_notify(IPCNS_CREATED); |
44 | register_ipcns_notifier(ns); | 45 | register_ipcns_notifier(ns); |
45 | 46 | ||
47 | ns->user_ns = old_ns->user_ns; | ||
48 | get_user_ns(ns->user_ns); | ||
49 | |||
46 | return ns; | 50 | return ns; |
47 | } | 51 | } |
48 | 52 | ||
@@ -50,7 +54,7 @@ struct ipc_namespace *copy_ipcs(unsigned long flags, struct ipc_namespace *ns) | |||
50 | { | 54 | { |
51 | if (!(flags & CLONE_NEWIPC)) | 55 | if (!(flags & CLONE_NEWIPC)) |
52 | return get_ipc_ns(ns); | 56 | return get_ipc_ns(ns); |
53 | return create_ipc_ns(); | 57 | return create_ipc_ns(ns); |
54 | } | 58 | } |
55 | 59 | ||
56 | /* | 60 | /* |
@@ -105,6 +109,7 @@ static void free_ipc_ns(struct ipc_namespace *ns) | |||
105 | * order to have a correct value when recomputing msgmni. | 109 | * order to have a correct value when recomputing msgmni. |
106 | */ | 110 | */ |
107 | ipcns_notify(IPCNS_REMOVED); | 111 | ipcns_notify(IPCNS_REMOVED); |
112 | put_user_ns(ns->user_ns); | ||
108 | } | 113 | } |
109 | 114 | ||
110 | /* | 115 | /* |