]> git.itanic.dy.fi Git - linux-stable/commit
btrfs: zoned: fix memory leak after finding block group with super blocks
authorFilipe Manana <fdmanana@suse.com>
Mon, 3 Jul 2023 11:03:21 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 06:46:54 +0000 (08:46 +0200)
commitab80a901f8daca07c4a54af0ab0de745c9918294
tree3a58168dfc9b423c5d510d265d38cadc7013ef8f
parent6ba7ac692a25354c4a43b32fd941f778d5b01bf8
btrfs: zoned: fix memory leak after finding block group with super blocks

commit f1a07c2b4e2c473ec322b8b9ece071b8c88a3512 upstream.

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: 12659251ca5d ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/block-group.c