]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix read_node_slot to return errors
authorLiu Bo <bo.li.liu@oracle.com>
Tue, 5 Jul 2016 19:10:14 +0000 (12:10 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Jul 2016 11:52:25 +0000 (13:52 +0200)
commit95b6e48357ebcecb4db498bf18bc73230a7a187b
treece23654b16f7de208bb88096b2c0f9208c4a5eca
parent517f423da2eeb2643cb2d36418c88b8303da25f7
Btrfs: fix read_node_slot to return errors

We use read_node_slot() to read btree node and it has two cases,
a) slot is out of range, which means 'no such entry'
b) we fail to read the block, due to checksum fails or corrupted
   content or not with uptodate flag.
But we're returning NULL in both cases, this makes it return -ENOENT
in case a) and return -EIO in case b), and this fixes its callers
as well as btrfs_search_forward() 's caller to catch the new errors.

The problem is reported by Peter Becker, and I can manage to
hit the same BUG_ON by mounting my fuzz image.

Reported-by: Peter Becker <floyd.net@gmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c
fs/btrfs/tree-log.c