public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
@ 2026-02-20 13:09 Mark Harmstone
  2026-02-20 13:13 ` Filipe Manana
  2026-02-20 15:58 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Harmstone @ 2026-02-20 13:09 UTC (permalink / raw)
  To: linux-btrfs, fdmanana; +Cc: Mark Harmstone, Chris Mason

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.

Signed-off-by: Mark Harmstone <mark@harmstone.com>
Fixes: 18ba64992871 ("btrfs: redirect I/O for remapped block groups")
Suggested-by: Chris Mason <clm@fb.com>
Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 83e2834ea273..1bd3464ccdd8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7082,7 +7082,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 
 		ret = btrfs_translate_remap(fs_info, &new_logical, length);
 		if (ret)
-			return ret;
+			goto out;
 
 		if (new_logical != logical) {
 			btrfs_free_chunk_map(map);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-20 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 13:09 [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap() Mark Harmstone
2026-02-20 13:13 ` Filipe Manana
2026-02-20 15:58 ` David Sterba
2026-02-20 16:27   ` Mark Harmstone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox