浏览代码

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

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason 13 年之前
父节点
当前提交
16780cabb8
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      fs/btrfs/ioctl.c

+ 6 - 0
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);