diff options
author | Filipe David Borba Manana <fdmanana@gmail.com> | 2013-10-28 12:28:30 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-11-11 22:10:36 -0500 |
commit | e46f5388cdde0f402f2dded6f1cad614536c6429 (patch) | |
tree | 1a51753979036d5e9344dbd5cfac4075d20e20ea /fs | |
parent | 9b011adfe14977fcda977234609d43ca52463a3d (diff) |
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 <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/dir-item.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index 1c529db1697f..c031ea3fd70f 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c | |||
@@ -474,8 +474,10 @@ int verify_dir_item(struct btrfs_root *root, | |||
474 | } | 474 | } |
475 | 475 | ||
476 | /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */ | 476 | /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */ |
477 | if (btrfs_dir_data_len(leaf, dir_item) > BTRFS_MAX_XATTR_SIZE(root)) { | 477 | if ((btrfs_dir_data_len(leaf, dir_item) + |
478 | printk(KERN_CRIT "btrfs: invalid dir item data len: %u\n", | 478 | btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) { |
479 | printk(KERN_CRIT "btrfs: invalid dir item name + data len: %u + %u\n", | ||
480 | (unsigned)btrfs_dir_name_len(leaf, dir_item), | ||
479 | (unsigned)btrfs_dir_data_len(leaf, dir_item)); | 481 | (unsigned)btrfs_dir_data_len(leaf, dir_item)); |
480 | return 1; | 482 | return 1; |
481 | } | 483 | } |