btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
PATCH 1/1 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.
--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/volumes.c +1 -1
@@ -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);
Signature · 1 line
2.52.0
Quoted 8 lines · Mark Harmstone
If the call to
btrfs_translate_remap()inbtrfs_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 <[email protected]>Fixes 18ba64992871 ("btrfs: redirect I/O for remapped block groups")Suggested-by Chris Mason <[email protected]>
It's a bug fix so this is more a Reported-by rather than a Suggested-by.
Otherwise,
Thanks.
Quoted 21 lines
--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/btrfs/volumes.c +1
-2@@ -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
Quoted 7 lines · Mark Harmstone
If the call to
btrfs_translate_remap()inbtrfs_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 <[email protected]>Fixes 18ba64992871 ("btrfs: redirect I/O for remapped block groups")Suggested-by Chris Mason <[email protected]>
If it's a but then it's Reported-by
Quoted 1 line
Please sort the tags according to
https://btrfs.readthedocs.io/en/latest/dev/Developer-s-FAQ.html#ordering
as it's been for a long time and saves me editing each patch. Thanks.
Quoted 9 lines · David Sterba
Quoted 7 lines · Mark Harmstone
If the call to
btrfs_translate_remap()inbtrfs_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 <[email protected]>Fixes 18ba64992871 ("btrfs: redirect I/O for remapped block groups")Suggested-by Chris Mason <[email protected]>
Quoted 8 lines
If it's a but then it's Reported-by
Quoted 1 line
Please sort the tags according to
https://btrfs.readthedocs.io/en/latest/dev/Developer-s-FAQ.html#orderingas it's been for a long time and saves me editing each patch. Thanks.
Okay, I've edited the patches and pushed them with the tags in the right order.