提交 e46f5388 编写于 作者: F Filipe David Borba Manana 提交者: Chris Mason

Btrfs: fix verification of dir_item

We were ignoring the name component of the dir_item. Both the
name and data must fit within BTRFS_MAX_XATTR_SIZE(root).
Signed-off-by: NFilipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 9b011adf
...@@ -474,8 +474,10 @@ int verify_dir_item(struct btrfs_root *root, ...@@ -474,8 +474,10 @@ int verify_dir_item(struct btrfs_root *root,
} }
/* BTRFS_MAX_XATTR_SIZE is the same for all dir items */ /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */
if (btrfs_dir_data_len(leaf, dir_item) > BTRFS_MAX_XATTR_SIZE(root)) { if ((btrfs_dir_data_len(leaf, dir_item) +
printk(KERN_CRIT "btrfs: invalid dir item data len: %u\n", btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) {
printk(KERN_CRIT "btrfs: invalid dir item name + data len: %u + %u\n",
(unsigned)btrfs_dir_name_len(leaf, dir_item),
(unsigned)btrfs_dir_data_len(leaf, dir_item)); (unsigned)btrfs_dir_data_len(leaf, dir_item));
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册