Btrfs: add validadtion checks for chunk loading
authorLiu Bo <[email protected]>
Fri, 3 Jun 2016 19:05:15 +0000 (12:05 -0700)
committerDavid Sterba <[email protected]>
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 <[email protected]>
Reported-by: Quentin Casasnovas <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: David Sterba <[email protected]>
fs/btrfs/volumes.c