OSDN Git Service

btrfs: propagate error to btrfs_cmp_data_prepare caller
authorNaohiro Aota <naohiro.aota@wdc.com>
Fri, 8 Sep 2017 08:48:55 +0000 (17:48 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2017 07:44:03 +0000 (09:44 +0200)
commitba44bc49bae6e9e25630388fefbbaa6c6bdd0a11
tree1dc1636bbfacc5f6991b2d898383a7621ebd1ca7
parentb86b6c226beafc28d5935ebb99590348cb48b633
btrfs: propagate error to btrfs_cmp_data_prepare caller

commit 78ad4ce014d025f41b8dde3a81876832ead643cf upstream.

btrfs_cmp_data_prepare() (almost) always returns 0 i.e. ignoring errors
from gather_extent_pages(). While the pages are freed by
btrfs_cmp_data_free(), cmp->num_pages still has > 0. Then,
btrfs_extent_same() try to access the already freed pages causing faults
(or violates PageLocked assertion).

This patch just return the error as is so that the caller stop the process.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Fixes: f441460202cb ("btrfs: fix deadlock with extent-same and readpage")
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ioctl.c