Skip to content

Commit e05be88

Browse files
fdmananakdave
authored andcommitted
btrfs: fix leaf leak in an error path in btrfs_del_items()
If the call to btrfs_del_leaf() fails we return without decrementing the extra ref we took on the leaf, therefore leaking it. Fix this by ensuring we drop the ref count before returning the error. Fixes: 751a276 ("btrfs: do not BUG_ON() on tree mod log failures at btrfs_del_ptr()") Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ac0ecda commit e05be88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/ctree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4586,9 +4586,9 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
45864586
if (btrfs_header_nritems(leaf) == 0) {
45874587
path->slots[1] = slot;
45884588
ret = btrfs_del_leaf(trans, root, path, leaf);
4589+
free_extent_buffer(leaf);
45894590
if (ret < 0)
45904591
return ret;
4591-
free_extent_buffer(leaf);
45924592
ret = 0;
45934593
} else {
45944594
/* if we're still in the path, make sure

0 commit comments

Comments
 (0)