btrfs: validate type when reading a chunk
authorGu Jinxiang <gujx@cn.fujitsu.com>
Wed, 4 Jul 2018 10:16:39 +0000 (18:16 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 11:12:55 +0000 (13:12 +0200)
commit315409b0098fb2651d86553f0436b70502b29bb2
tree253fe1458aade4cc3ea561c2e663f173dae807dc
parentb0132a3be5daf84116833542717ff5692f51640e
btrfs: validate type when reading a chunk

Reported in https://bugzilla.kernel.org/show_bug.cgi?id=199839, with an
image that has an invalid chunk type but does not return an error.

Add chunk type check in btrfs_check_chunk_valid, to detect the wrong
type combinations.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=199839
Reported-by: Xu Wen <wen.xu@gatech.edu>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c