btrfs-progs: add validation checks for chunk loading
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 2 May 2016 18:18:53 +0000 (11:18 -0700)
committerDavid Sterba <dsterba@suse.com>
Wed, 11 May 2016 14:37:23 +0000 (16:37 +0200)
commit9988284574c1692e5181ecd6f8b9e2512b0503ae
tree630f405c3ecec8b6296c2d0ea7e4d2ea8f384a9e
parentece1cef7099b8781232f4248ac65c825f770cfb6
btrfs-progs: add validation checks for chunk loading

To survive fuzz filesystem images, we need various validation checks to
make btrfsck detect any invalid value inside chunks including those in
 sys_array.

Note that these checks may not be sufficient to cover all corner cases,
we may need to add more later.

This also refractor previous various checks into a helper function so
that we can add more checks into it in the future.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
volumes.c