Btrfs: add validadtion checks for chunk loading
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 3 Jun 2016 19:05:15 +0000 (12:05 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Jun 2016 08:57:09 +0000 (10:57 +0200)
commite06cd3dd7cea50e87663a88acdfdb7ac1c53a5ca
treede24cda9966c078446f925c2cd02b60ee7cbeb4c
parent99e3ecfcb9f4ca35192d20a5bea158b81f600062
Btrfs: add validadtion checks for chunk loading

To prevent fuzzed filesystem images from panic the whole system,
we need various validation checks to refuse to mount such an image
if btrfs finds any invalid value during loading chunks, including
both sys_array and regular chunks.

Note that these checks may not be sufficient to cover all corner cases,
feel free to add more checks.

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