Message ID | 92dbe59fdd79544067340f09449e6fdda0902ff5.1688382073.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: fix leak after finding block group with super blocks on zoned fs | expand |
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
On 3/7/23 19:03, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > 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") > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com>
On Mon, Jul 03, 2023 at 12:03:21PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > 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") > Signed-off-by: Filipe Manana <fdmanana@suse.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index f53297726238..b7da14848686 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2088,6 +2088,7 @@ static int exclude_super_stripes(struct btrfs_block_group *cache) /* Shouldn't have super stripes in sequential zones */ if (zoned && nr) { + kfree(logical); btrfs_err(fs_info, "zoned: block group %llu must not contain super block", cache->start);