OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:38:54 +0000 (17:38 +0100)
commit71341a8a703752278bbaf6e4502f78ff50e645f7
treec3dff579c9fef0e09e9a75d65d47d3c4ee8ac084
parent9a8215c0a91e9182761d52e933fd635c7a7a47cd
Btrfs: bail out gracefully rather than BUG_ON

[ Upstream commit 56a0e706fcf870270878d6d72b71092ae42d229c ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c