summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-02-21 04:14:55 +0100
committerChris Mason <chris.mason@oracle.com>2012-02-23 16:43:45 +0100
commit16780cabb877dbd0c8c5e9ff9bdebd6c5bdd1a7b (patch)
treed244896098a1e8dfd23403a335315a4b822c95d3 /fs/btrfs/ioctl.c
parentBtrfs: make sure we update latest_bdev (diff)
downloadlinux-16780cabb877dbd0c8c5e9ff9bdebd6c5bdd1a7b.tar.xz
linux-16780cabb877dbd0c8c5e9ff9bdebd6c5bdd1a7b.zip
Btrfs: add extra sanity checks on the path names in btrfs_mksubvol
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to '')
-rw-r--r--fs/btrfs/ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e9bdb8b783e5..05446f77f99b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1333,6 +1333,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);