]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: fix transaction handle leaks in btrfs_last_identity_remap_gone()
authorMark Harmstone <mark@harmstone.com>
Thu, 19 Feb 2026 14:16:02 +0000 (14:16 +0000)
committerDavid Sterba <dsterba@suse.com>
Thu, 26 Feb 2026 14:03:29 +0000 (15:03 +0100)
btrfs_abort_transaction(), unlike btrfs_commit_transaction(), doesn't
also free the transaction handle. Fix the instances in
btrfs_last_identity_remap_gone() where we're also leaking the
transaction on abort.

Reported-by: Chris Mason <clm@fb.com>
Link: https://lore.kernel.org/linux-btrfs/20260125125129.2245240-1-clm@meta.com/
Fixes: 979e1dc3d69e ("btrfs: handle deletions from remapped block group")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c

index fcd0a2ba3554607abb4eb1a8e07621eebcbdaa5c..2119dddd6f8ee058b6223508b211078ff121cfc4 100644 (file)
@@ -4723,6 +4723,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
        ret = btrfs_remove_dev_extents(trans, chunk_map);
        if (unlikely(ret)) {
                btrfs_abort_transaction(trans, ret);
+               btrfs_end_transaction(trans);
                return ret;
        }
 
@@ -4732,6 +4733,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
                if (unlikely(ret)) {
                        mutex_unlock(&trans->fs_info->chunk_mutex);
                        btrfs_abort_transaction(trans, ret);
+                       btrfs_end_transaction(trans);
                        return ret;
                }
        }
@@ -4750,6 +4752,7 @@ int btrfs_last_identity_remap_gone(struct btrfs_chunk_map *chunk_map,
        ret = remove_chunk_stripes(trans, chunk_map, path);
        if (unlikely(ret)) {
                btrfs_abort_transaction(trans, ret);
+               btrfs_end_transaction(trans);
                return ret;
        }