This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / fs / super.c
index 38c23bf..37b76d7 100644 (file)
@@ -35,6 +35,8 @@
 #include <linux/vfs.h>
 #include <linux/writeback.h>           /* for the emergency remount stuff */
 #include <linux/idr.h>
+#include <linux/devpts_fs.h>
+#include <linux/proc_fs.h>
 #include <asm/uaccess.h>
 
 
@@ -786,6 +788,13 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
        sb = type->get_sb(type, flags, name, data);
        if (IS_ERR(sb))
                goto out_free_secdata;
+
+       error = -EPERM;
+       if (!capable(CAP_SYS_ADMIN) && !sb->s_bdev &&
+               (sb->s_magic != PROC_SUPER_MAGIC) &&
+               (sb->s_magic != DEVPTS_SUPER_MAGIC))
+               goto out_sb;
+
        error = security_sb_kern_mount(sb, secdata);
        if (error)
                goto out_sb;