Commit 16780cab authored by Chris Mason's avatar Chris Mason

Btrfs: add extra sanity checks on the path names in btrfs_mksubvol

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a6b0d5c8
...@@ -1333,6 +1333,12 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, ...@@ -1333,6 +1333,12 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
goto out; goto out;
} }
if (name[0] == '.' &&
(namelen == 1 || (name[1] == '.' && namelen == 2))) {
ret = -EEXIST;
goto out;
}
if (subvol) { if (subvol) {
ret = btrfs_mksubvol(&file->f_path, name, namelen, ret = btrfs_mksubvol(&file->f_path, name, namelen,
NULL, transid, readonly); NULL, transid, readonly);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment