diff options
author | Filipe Manana <fdmanana@suse.com> | 2018-06-11 20:24:16 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-06-22 12:59:08 +0200 |
commit | c5b4a50b74018b3677098151ec5f4fce07d5e6a0 (patch) | |
tree | 7f913f1c852140049b4b63efb073feb8469e75f4 /lib | |
parent | btrfs: fix invalid-free in btrfs_extent_same (diff) | |
download | linux-c5b4a50b74018b3677098151ec5f4fce07d5e6a0.tar.xz linux-c5b4a50b74018b3677098151ec5f4fce07d5e6a0.zip |
Btrfs: fix return value on rename exchange failure
If we failed during a rename exchange operation after starting/joining a
transaction, we would end up replacing the return value, stored in the
local 'ret' variable, with the return value from btrfs_end_transaction().
So this could end up returning 0 (success) to user space despite the
operation having failed and aborted the transaction, because if there are
multiple tasks having a reference on the transaction at the time
btrfs_end_transaction() is called by the rename exchange, that function
returns 0 (otherwise it returns -EIO and not the original error value).
So fix this by not overwriting the return value on error after getting
a transaction handle.
Fixes: cdd1fedf8261 ("btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT")
CC: stable@vger.kernel.org # 4.9+
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 'lib')
0 files changed, 0 insertions, 0 deletions