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: MMI-PSA29.97-13-9~17312^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16780cabb877dbd0c8c5e9ff9bdebd6c5bdd1a7b;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.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 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);