]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: add extra sanity checks on the path names in btrfs_mksubvol
authorChris Mason <chris.mason@oracle.com>
Tue, 21 Feb 2012 03:14:55 +0000 (22:14 -0500)
committerChris Mason <chris.mason@oracle.com>
Tue, 21 Feb 2012 03:14:55 +0000 (22:14 -0500)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index d3bd1db41e67e8afa15a627f0d445aeb1b8c58ed..471e805ed3f93bc0383cd8b97bedba1b6fd8dcb6 100644 (file)
@@ -1327,6 +1327,12 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
                goto out;
        }
 
+       if (name[0] == '.' &&
+          (namelen == 1 || (name[1] == '.' && namelen == 2))) {
+               ret = -EEXIST;
+               goto out;
+       }
+
        if (subvol) {
                ret = btrfs_mksubvol(&file->f_path, name, namelen,
                                     NULL, transid, readonly);