From: Mark Harmstone <mark@harmstone.com>
To: linux-btrfs@vger.kernel.org, fdmanana@kernel.org
Cc: Mark Harmstone <mark@harmstone.com>, Chris Mason <clm@fb.com>
Subject: [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
Date: Fri, 20 Feb 2026 13:09:54 +0000 [thread overview]
Message-ID: <20260220131002.6269-1-mark@harmstone.com> (raw)
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
next reply other threads:[~2026-02-20 13:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 13:09 Mark Harmstone [this message]
2026-02-20 13:13 ` [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap() Filipe Manana
2026-02-20 15:58 ` David Sterba
2026-02-20 16:27 ` Mark Harmstone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260220131002.6269-1-mark@harmstone.com \
--to=mark@harmstone.com \
--cc=clm@fb.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.