Message ID | 0bdc61c9216d238eaa4abb6edfb1c5d9c8e86c52.1707775003.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: zoned: fix chunk map leak when loading block group zone info | expand |
On 2/13/24 03:29, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > At btrfs_load_block_group_zone_info() we never drop a reference on the > chunk map we have looked up, therefore leaking a reference on it. So > add the missing btrfs_free_chunk_map() at the end of the function. > > Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps") > Reported-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> > --- > fs/btrfs/zoned.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index d9716456bce0..46537d606dc3 100644 > --- a/fs/btrfs/zoned.c > +++ b/fs/btrfs/zoned.c > @@ -1668,6 +1668,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) > } > bitmap_free(active); > kfree(zone_info); > + btrfs_free_chunk_map(map); > > return ret; > }
On 12.02.24 22:59, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > At btrfs_load_block_group_zone_info() we never drop a reference on the > chunk map we have looked up, therefore leaking a reference on it. So > add the missing btrfs_free_chunk_map() at the end of the function. > > Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps") > Reported-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Signed-off-by: Filipe Manana <fdmanana@suse.com> > --- > fs/btrfs/zoned.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index d9716456bce0..46537d606dc3 100644 > --- a/fs/btrfs/zoned.c > +++ b/fs/btrfs/zoned.c > @@ -1668,6 +1668,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) > } > bitmap_free(active); > kfree(zone_info); > + btrfs_free_chunk_map(map); > > return ret; > } Thanks a lot Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index d9716456bce0..46537d606dc3 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1668,6 +1668,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) } bitmap_free(active); kfree(zone_info); + btrfs_free_chunk_map(map); return ret; }