Skip to content

Commit ede600e

Browse files
fdmananakdave
authored andcommitted
btrfs: fix extent buffer leak after tree mod log failure at split_node()
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: 5de865e ("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>
1 parent d09c515 commit ede600e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/btrfs/ctree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
30533053

30543054
ret = btrfs_tree_mod_log_eb_copy(split, c, 0, mid, c_nritems - mid);
30553055
if (ret) {
3056+
btrfs_tree_unlock(split);
3057+
free_extent_buffer(split);
30563058
btrfs_abort_transaction(trans, ret);
30573059
return ret;
30583060
}

0 commit comments

Comments
 (0)