]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: tests: fix chunk map leak after failure to add it to the tree
authorFilipe Manana <fdmanana@suse.com>
Tue, 11 Mar 2025 15:50:50 +0000 (15:50 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:18:14 +0000 (10:18 +0200)
commit6f38cbdf2add06942dcfe6054df46e90815481ff
tree8d47101dd65466c179f597b9477100278c863500
parent7a0ca7bafc0f4b84795a59bdb5281f0174346ab2
btrfs: tests: fix chunk map leak after failure to add it to the tree

commit 009ca358486ded9b4822eddb924009b6848d7271 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: 7dc66abb5a47 ("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>
fs/btrfs/tests/extent-map-tests.c