summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorFilipe Manana2019-02-18 17:57:26 +0100
committerDavid Sterba2019-02-25 14:19:23 +0100
commitcbca7d59fea4e81ee3bf724cf20018f96d53ccea (patch)
treec3a896b5ab18e6d1054e3a30b0408d91d1d3bfa2 /fs/btrfs/tree-log.c
parentbtrfs: drop the lock on error in btrfs_dev_replace_cancel (diff)
downloadkernel-qcow2-linux-cbca7d59fea4e81ee3bf724cf20018f96d53ccea.tar.gz
kernel-qcow2-linux-cbca7d59fea4e81ee3bf724cf20018f96d53ccea.tar.xz
kernel-qcow2-linux-cbca7d59fea4e81ee3bf724cf20018f96d53ccea.zip
Btrfs: add missing error handling after doing leaf/node binary search
The function map_private_extent_buffer() can return an -EINVAL error, and it is called by generic_bin_search() which will return back the error. The btrfs_bin_search() function in turn calls generic_bin_search() and the key_search() function calls btrfs_bin_search(), so both can return the -EINVAL error coming from the map_private_extent_buffer() function. Some callers of these functions were ignoring that these functions can return an error, so fix them to deal with error return values. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e76345f52beb..f06454a55e00 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3767,6 +3767,8 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans,
found_key.type = 0;
ret = btrfs_bin_search(path->nodes[0], &found_key, 0,
&start_slot);
+ if (ret < 0)
+ break;
ret = btrfs_del_items(trans, log, path, start_slot,
path->slots[0] - start_slot + 1);