diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2025-10-08 14:18:59 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-23 16:24:24 +0200 |
| commit | 602701d00439e113331ee9c1283e95afdcb8849d (patch) | |
| tree | dbf438efd0028745a8e942fb279d5d293b89c33e /fs | |
| parent | 672a5fea229e92356601db06960e0e55a0a5e9b3 (diff) | |
| download | linux-602701d00439e113331ee9c1283e95afdcb8849d.tar.gz linux-602701d00439e113331ee9c1283e95afdcb8849d.tar.bz2 linux-602701d00439e113331ee9c1283e95afdcb8849d.zip | |
btrfs: fix memory leaks when rejecting a non SINGLE data profile without an RST
commit fec9b9d3ced39f16be8d7afdf81f4dd2653da319 upstream.
At the end of btrfs_load_block_group_zone_info() the first thing we do
is to ensure that if the mapping type is not a SINGLE one and there is
no RAID stripe tree, then we return early with an error.
Doing that, though, prevents the code from running the last calls from
this function which are about freeing memory allocated during its
run. Hence, in this case, instead of returning early, we set the ret
value and fall through the rest of the cleanup code.
Fixes: 5906333cc4af ("btrfs: zoned: don't skip block group profile checks on conventional zones")
CC: stable@vger.kernel.org # 6.8+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/btrfs/zoned.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index f426276e2b6b..87c5dd3ad016 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1753,7 +1753,7 @@ out: !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; + ret = -EINVAL; } if (cache->alloc_offset > cache->zone_capacity) { |
