aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index ade739f67f1d..0b13ace266f2 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -305,8 +305,9 @@ err:
305static int mqueue_fill_super(struct super_block *sb, void *data, int silent) 305static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
306{ 306{
307 struct inode *inode; 307 struct inode *inode;
308 struct ipc_namespace *ns = data; 308 struct ipc_namespace *ns = sb->s_fs_info;
309 309
310 sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
310 sb->s_blocksize = PAGE_SIZE; 311 sb->s_blocksize = PAGE_SIZE;
311 sb->s_blocksize_bits = PAGE_SHIFT; 312 sb->s_blocksize_bits = PAGE_SHIFT;
312 sb->s_magic = MQUEUE_MAGIC; 313 sb->s_magic = MQUEUE_MAGIC;
@@ -326,17 +327,14 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
326 int flags, const char *dev_name, 327 int flags, const char *dev_name,
327 void *data) 328 void *data)
328{ 329{
329 if (!(flags & MS_KERNMOUNT)) { 330 struct ipc_namespace *ns;
330 struct ipc_namespace *ns = current->nsproxy->ipc_ns; 331 if (flags & MS_KERNMOUNT) {
331 /* Don't allow mounting unless the caller has CAP_SYS_ADMIN 332 ns = data;
332 * over the ipc namespace. 333 data = NULL;
333 */ 334 } else {
334 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN)) 335 ns = current->nsproxy->ipc_ns;
335 return ERR_PTR(-EPERM);
336
337 data = ns;
338 } 336 }
339 return mount_ns(fs_type, flags, data, mqueue_fill_super); 337 return mount_ns(fs_type, flags, data, ns, ns->user_ns, mqueue_fill_super);
340} 338}
341 339
342static void init_once(void *foo) 340static void init_once(void *foo)