mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
xfs: fix memory leak on error in xfs_alloc_zone_info()
Currently, the 0th index of the zi_used_bucket_bitmap array is not freed
on error due to the pre-decrement then evaluate semantic of the while
loop used in xfs_alloc_zone_info(). Fix it by allowing for the i == 0
case to be covered.
Fixes: 080d01c41d ("xfs: implement zoned garbage collection")
Cc: stable@vger.kernel.org # v6.15
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
939919ccdd
commit
592975da8c
|
|
@ -1217,7 +1217,7 @@ xfs_alloc_zone_info(
|
|||
return zi;
|
||||
|
||||
out_free_bitmaps:
|
||||
while (--i > 0)
|
||||
while (--i >= 0)
|
||||
kvfree(zi->zi_used_bucket_bitmap[i]);
|
||||
kfree(zi);
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user