Btrfs: bail out gracefully rather than BUG_ON
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 30 Oct 2017 17:14:38 +0000 (11:14 -0600)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Nov 2017 13:47:01 +0000 (14:47 +0100)
commit56a0e706fcf870270878d6d72b71092ae42d229c
treeb805b64c6152ce3c2f228405e62847960601bed2
parent619c47f3d4cd7a60576fd15e133a2eee4fcc0c4e
Btrfs: bail out gracefully rather than BUG_ON

If a file's DIR_ITEM key is invalid (due to memory errors) and gets
written to disk, a future lookup_path can end up with kernel panic due
to BUG_ON().

This gets rid of the BUG_ON(), meanwhile output the corrupted key and
return ENOENT if it's invalid.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reported-by: Guillaume Bouchard <bouchard@mercs-eng.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c