mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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: Filipe David Borba Manana <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Chris Mason <[email protected]>
This commit is contained in:
parent
9b011adfe1
commit
e46f5388cd
1 changed files with 4 additions and 2 deletions
|
|
@ -474,8 +474,10 @@ int verify_dir_item(struct btrfs_root *root,
|
|||
}
|
||||
|
||||
/* BTRFS_MAX_XATTR_SIZE is the same for all dir items */
|
||||
if (btrfs_dir_data_len(leaf, dir_item) > BTRFS_MAX_XATTR_SIZE(root)) {
|
||||
printk(KERN_CRIT "btrfs: invalid dir item data len: %u\n",
|
||||
if ((btrfs_dir_data_len(leaf, dir_item) +
|
||||
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));
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue