diff options
author | Qu Wenruo <wqu@suse.com> | 2019-12-17 18:58:20 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-01 13:17:28 +0200 |
commit | d64f6dfdf4ab2d8c1c67718d5a8d6e735ef49f12 (patch) | |
tree | a7531753556adf7fa5e02d58ca4fa8d0b2afc4ae /fs/inode.c | |
parent | 2bbe85d911feb8faeeab92b81967ffd3431d430e (diff) | |
download | linux-stable-d64f6dfdf4ab2d8c1c67718d5a8d6e735ef49f12.tar.gz linux-stable-d64f6dfdf4ab2d8c1c67718d5a8d6e735ef49f12.tar.bz2 linux-stable-d64f6dfdf4ab2d8c1c67718d5a8d6e735ef49f12.zip |
btrfs: tree-checker: Check leaf chunk item size
[ Upstream commit f6d2a5c263afca84646cf3300dc13061bedbd99e ]
Inspired by btrfs-progs github issue #208, where chunk item in chunk
tree has invalid num_stripes (0).
Although that can already be caught by current btrfs_check_chunk_valid(),
that function doesn't really check item size as it needs to handle chunk
item in super block sys_chunk_array().
This patch will add two extra checks for chunk items in chunk tree:
- Basic chunk item size
If the item is smaller than btrfs_chunk (which already contains one
stripe), exit right now as reading num_stripes may even go beyond
eb boundary.
- Item size check against num_stripes
If item size doesn't match with calculated chunk size, then either the
item size or the num_stripes is corrupted. Error out anyway.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/inode.c')
0 files changed, 0 insertions, 0 deletions