Re: [PATCH v2] btrfs: fix memory leaks when rejecting a non SINGLE data profile without an RST

From: Johannes Thumshirn
Date: Wed Oct 08 2025 - 08:04:43 EST


On 10/8/25 9:41 AM, Miquel Sabaté Solà wrote:
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index e3341a84f4ab..8f767a6cd49b 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -1753,7 +1753,11 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)
> !fs_info->stripe_root) {
> btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree",
> btrfs_bg_type_to_raid_name(map->type));
> - return -EINVAL;
> + /*
> + * Note that this might be overwritten by later if statements,
> + * but the error will be at least printed by the line above.
> + */


Not convinced the comment is useful.

> + ret = -EINVAL;
> }
>
> if (unlikely(cache->alloc_offset > cache->zone_capacity)) {
> @@ -1785,6 +1789,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)
> btrfs_free_chunk_map(cache->physical_map);
> cache->physical_map = NULL;
> }
> +
> bitmap_free(active);
> kfree(zone_info);
>


Stray newline.

Other than that,

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>