diff options
-rw-r--r-- | ipc/namespace.c | 6 | ||||
-rw-r--r-- | kernel/nsproxy.c | 3 | ||||
-rw-r--r-- | kernel/utsname.c | 7 | ||||
-rw-r--r-- | net/core/net_namespace.c | 7 |
4 files changed, 17 insertions, 6 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c index f362298c5ce4..6ed33c05cb66 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
@@ -161,8 +161,12 @@ static void ipcns_put(void *ns) | |||
161 | return put_ipc_ns(ns); | 161 | return put_ipc_ns(ns); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int ipcns_install(struct nsproxy *nsproxy, void *ns) | 164 | static int ipcns_install(struct nsproxy *nsproxy, void *new) |
165 | { | 165 | { |
166 | struct ipc_namespace *ns = new; | ||
167 | if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN)) | ||
168 | return -EPERM; | ||
169 | |||
166 | /* Ditch state from the old ipc namespace */ | 170 | /* Ditch state from the old ipc namespace */ |
167 | exit_sem(current); | 171 | exit_sem(current); |
168 | put_ipc_ns(nsproxy->ipc_ns); | 172 | put_ipc_ns(nsproxy->ipc_ns); |
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index a214e0e9035f..4357a0a7d17d 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -242,9 +242,6 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
242 | struct file *file; | 242 | struct file *file; |
243 | int err; | 243 | int err; |
244 | 244 | ||
245 | if (!capable(CAP_SYS_ADMIN)) | ||
246 | return -EPERM; | ||
247 | |||
248 | file = proc_ns_fget(fd); | 245 | file = proc_ns_fget(fd); |
249 | if (IS_ERR(file)) | 246 | if (IS_ERR(file)) |
250 | return PTR_ERR(file); | 247 | return PTR_ERR(file); |
diff --git a/kernel/utsname.c b/kernel/utsname.c index 679d97a5d3fd..4a9362f9325d 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c | |||
@@ -102,8 +102,13 @@ static void utsns_put(void *ns) | |||
102 | put_uts_ns(ns); | 102 | put_uts_ns(ns); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int utsns_install(struct nsproxy *nsproxy, void *ns) | 105 | static int utsns_install(struct nsproxy *nsproxy, void *new) |
106 | { | 106 | { |
107 | struct uts_namespace *ns = new; | ||
108 | |||
109 | if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN)) | ||
110 | return -EPERM; | ||
111 | |||
107 | get_uts_ns(ns); | 112 | get_uts_ns(ns); |
108 | put_uts_ns(nsproxy->uts_ns); | 113 | put_uts_ns(nsproxy->uts_ns); |
109 | nsproxy->uts_ns = ns; | 114 | nsproxy->uts_ns = ns; |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6456439cbbd9..ec2870b44c1f 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -630,8 +630,13 @@ static void netns_put(void *ns) | |||
630 | 630 | ||
631 | static int netns_install(struct nsproxy *nsproxy, void *ns) | 631 | static int netns_install(struct nsproxy *nsproxy, void *ns) |
632 | { | 632 | { |
633 | struct net *net = ns; | ||
634 | |||
635 | if (!ns_capable(net->user_ns, CAP_SYS_ADMIN)) | ||
636 | return -EPERM; | ||
637 | |||
633 | put_net(nsproxy->net_ns); | 638 | put_net(nsproxy->net_ns); |
634 | nsproxy->net_ns = get_net(ns); | 639 | nsproxy->net_ns = get_net(net); |
635 | return 0; | 640 | return 0; |
636 | } | 641 | } |
637 | 642 | ||