From: Chris Mason Date: Tue, 21 Feb 2012 03:14:55 +0000 (-0500) Subject: Btrfs: add extra sanity checks on the path names in btrfs_mksubvol X-Git-Tag: v2.6.39-400.9.0~607^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=370b122601ddb4585671cdb4e7dd26bc17abd6c0;p=users%2Fjedix%2Flinux-maple.git Btrfs: add extra sanity checks on the path names in btrfs_mksubvol Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d3bd1db41e67..471e805ed3f9 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -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);