Skip to content

Commit 54b9395

Browse files
maharmstonekdave
authored andcommitted
btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
If the call to btrfs_translate_remap() in btrfs_map_block() returns an error code, we were leaking the chunk map. Fix it by jumping to out rather than returning directly. Reported-by: Chris Mason <clm@fb.com> Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/ Fixes: 18ba649 ("btrfs: redirect I/O for remapped block groups") 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>
1 parent f15fb3d commit 54b9395

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/btrfs/volumes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6907,7 +6907,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
69076907

69086908
ret = btrfs_translate_remap(fs_info, &new_logical, length);
69096909
if (ret)
6910-
return ret;
6910+
goto out;
69116911

69126912
if (new_logical != logical) {
69136913
btrfs_free_chunk_map(map);

0 commit comments

Comments
 (0)