Message ID | 20191010023928.24586-2-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: Introduce new incompat feature BG_TREE to hugely reduce mount time | expand |
On 10/10/19 10:39 AM, Qu Wenruo wrote: > In btrfs_read_block_groups(), if we have an invalid block group which > has mixed type (DATA|METADATA) while the fs doesn't have MIX_BGS > feature, we error out without freeing the block group cache. > > This patch will add the missing btrfs_put_block_group() to prevent > memory leak. > > Fixes: 49303381f19a ("Btrfs: bail out if block group has different mixed flag") > Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
On Thu, Oct 10, 2019 at 10:39:26AM +0800, Qu Wenruo wrote: > In btrfs_read_block_groups(), if we have an invalid block group which > has mixed type (DATA|METADATA) while the fs doesn't have MIX_BGS > feature, we error out without freeing the block group cache. > > This patch will add the missing btrfs_put_block_group() to prevent > memory leak. > > Fixes: 49303381f19a ("Btrfs: bail out if block group has different mixed flag") > Signed-off-by: Qu Wenruo <wqu@suse.com> Please send independent fixes out of feature patchsets so it does not get lost due to priorities fixes vs features. I'll add it to misc-next and queue for 5.4. Thanks.
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index bf7e3f23bba7..c906a2b6c2cf 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1762,6 +1762,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups", cache->key.objectid); ret = -EINVAL; + btrfs_put_block_group(cache); goto error; }
In btrfs_read_block_groups(), if we have an invalid block group which has mixed type (DATA|METADATA) while the fs doesn't have MIX_BGS feature, we error out without freeing the block group cache. This patch will add the missing btrfs_put_block_group() to prevent memory leak. Fixes: 49303381f19a ("Btrfs: bail out if block group has different mixed flag") Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/block-group.c | 1 + 1 file changed, 1 insertion(+)