mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-24 11:25:43 +00:00
btrfs: fix extent buffer leak after tree mod log failure at split_node()
commitede600e497
upstream. At split_node(), if we fail to log the tree mod log copy operation, we return without unlocking the split extent buffer we just allocated and without decrementing the reference we own on it. Fix this by unlocking it and decrementing the ref count before returning. Fixes:5de865eebb
("Btrfs: fix tree mod logging") CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo <wqu@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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a53d78d9a8
commit
bc662a1e1f
1 changed files with 2 additions and 0 deletions
|
@ -2861,6 +2861,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
|
|||
|
||||
ret = btrfs_tree_mod_log_eb_copy(split, c, 0, mid, c_nritems - mid);
|
||||
if (ret) {
|
||||
btrfs_tree_unlock(split);
|
||||
free_extent_buffer(split);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue