Skip to content

Commit

Permalink
Btrfs: add extra sanity checks on the path names in btrfs_mksubvol
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
chrismason-xx committed Feb 23, 2012
1 parent a6b0d5c commit 16780ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 16780ca

Please sign in to comment.