Skip to content

Commit b9af27d

Browse files
fdmananagregkh
authored andcommitted
btrfs: tests: fix chunk map leak after failure to add it to the tree
commit 009ca35 upstream. If we fail to add the chunk map to the fs mapping tree we exit test_rmap_block() without freeing the chunk map. Fix this by adding a call to btrfs_free_chunk_map() before exiting the test function if the call to btrfs_add_chunk_map() failed. Fixes: 7dc66ab ("btrfs: use a dedicated data structure for chunk maps") CC: stable@vger.kernel.org # 6.12+ Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 601db4e commit b9af27d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/tests/extent-map-tests.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
10451045
ret = btrfs_add_chunk_map(fs_info, map);
10461046
if (ret) {
10471047
test_err("error adding chunk map to mapping tree");
1048+
btrfs_free_chunk_map(map);
10481049
goto out_free;
10491050
}
10501051

0 commit comments

Comments
 (0)