Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[cascardo/linux.git] / ipc / mqueue.c
index ade739f..0b13ace 100644 (file)
@@ -305,8 +305,9 @@ err:
 static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *inode;
-       struct ipc_namespace *ns = data;
+       struct ipc_namespace *ns = sb->s_fs_info;
 
+       sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
        sb->s_blocksize = PAGE_SIZE;
        sb->s_blocksize_bits = PAGE_SHIFT;
        sb->s_magic = MQUEUE_MAGIC;
@@ -326,17 +327,14 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
                         int flags, const char *dev_name,
                         void *data)
 {
-       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;
+       struct ipc_namespace *ns;
+       if (flags & MS_KERNMOUNT) {
+               ns = data;
+               data = NULL;
+       } else {
+               ns = current->nsproxy->ipc_ns;
        }
-       return mount_ns(fs_type, flags, data, mqueue_fill_super);
+       return mount_ns(fs_type, flags, data, ns, ns->user_ns, mqueue_fill_super);
 }
 
 static void init_once(void *foo)