Skip to content

Commit f1a07c2

Browse files
fdmananakdave
authored andcommitted
btrfs: zoned: fix memory leak after finding block group with super blocks
At exclude_super_stripes(), if we happen to find a block group that has super blocks mapped to it and we are on a zoned filesystem, we error out as this is not supposed to happen, indicating either a bug or maybe some memory corruption for example. However we are exiting the function without freeing the memory allocated for the logical address of the super blocks. Fix this by freeing the logical address. Fixes: 1265925 ("btrfs: implement log-structured superblock for ZONED mode") CC: stable@vger.kernel.org # 5.10+ Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 0657b20 commit f1a07c2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/block-group.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,7 @@ static int exclude_super_stripes(struct btrfs_block_group *cache)
20882088

20892089
/* Shouldn't have super stripes in sequential zones */
20902090
if (zoned && nr) {
2091+
kfree(logical);
20912092
btrfs_err(fs_info,
20922093
"zoned: block group %llu must not contain super block",
20932094
cache->start);

0 commit comments

Comments
 (0)