diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-16 16:02:41 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-16 16:02:41 +0100 |
| commit | 60f7110e36ff7858182e8990a2d19fa3df7e05f5 (patch) | |
| tree | 179c2a9f8fe654694d40536a506345db80705436 /ipc/mqueue.c | |
| parent | 9659293c1784f3d9df2235f6ebf92f6f9059a563 (diff) | |
| parent | 41ef2d5678d83af030125550329b6ae8b74618fa (diff) | |
Merge tag 'v3.9-rc7' into regmap-cache
Linux 3.9-rc7
Diffstat (limited to 'ipc/mqueue.c')
| -rw-r--r-- | ipc/mqueue.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index e5c4f609f22..e4e47f64744 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; |
