]> git.hungrycats.org Git - linux/commit
btrfs: tree-checker: Check item size before reading file extent type
authorQu Wenruo <wqu@suse.com>
Mon, 2 Sep 2019 23:46:19 +0000 (07:46 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 11:47:07 +0000 (12:47 +0100)
commitc6284083756a84be3e521b2fa87d07e8444a2274
treee4d4eb44f62ce2889a7527e0dc43db2dfc364b58
parent1a57f82bb32a7891b262987e838271e588e63854
btrfs: tree-checker: Check item size before reading file extent type

In check_extent_data_item(), we read file extent type without verifying
if the item size is valid.

Add such check to ensure the file extent type we read is correct.

The check is not as accurate as we need to cover both inline and regular
extents, so it only checks if the item size is larger or equal to inline
header.
So the existing size checks on inline/regular extents are still needed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-checker.c