summaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-04-03 22:18:36 +0200
committerLinus Walleij <linus.walleij@linaro.org>2013-04-03 22:18:36 +0200
commit6a7b3e970426f4bc2a8d52f81a4fda6595a9f052 (patch)
tree055765564c839e456fbe4c65c8cd2c4b00d731b7 /ipc/mqueue.c
parent661462f4c6d3c9ae0bac193c65936ebfac4c95b4 (diff)
parent07961ac7c0ee8b546658717034fe692fd12eefa9 (diff)
downloadop-kernel-dev-6a7b3e970426f4bc2a8d52f81a4fda6595a9f052.zip
op-kernel-dev-6a7b3e970426f4bc2a8d52f81a4fda6595a9f052.tar.gz
Merge tag 'v3.9-rc5' into devel
Linux 3.9-rc5 Conflicts: drivers/pinctrl/pinconf.c
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e5c4f60..e4e47f6 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -330,8 +330,16 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data)
{
- if (!(flags & MS_KERNMOUNT))
- data = current->nsproxy->ipc_ns;
+ if (!(flags & MS_KERNMOUNT)) {
+ struct ipc_namespace *ns = current->nsproxy->ipc_ns;
+ /* Don't allow mounting unless the caller has CAP_SYS_ADMIN
+ * over the ipc namespace.
+ */
+ if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
+ return ERR_PTR(-EPERM);
+
+ data = ns;
+ }
return mount_ns(fs_type, flags, data, mqueue_fill_super);
}
@@ -840,7 +848,8 @@ out_putfd:
fd = error;
}
mutex_unlock(&root->d_inode->i_mutex);
- mnt_drop_write(mnt);
+ if (!ro)
+ mnt_drop_write(mnt);
out_putname:
putname(name);
return fd;
OpenPOWER on IntegriCloud