Re: [PATCH] xfs: free up mp->m_free[0].count in error case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 05, 2025 at 04:35:49PM -0700, Wengang Wang wrote:
> In xfs_init_percpu_counters(), memory for mp->m_free[0].count wasn't freed
> in error case. Free it up in this patch.
> 
> Signed-off-by: Wengang Wang <wen.gang.wang@xxxxxxxxxx>

Yeah, that looks like a leak.

Fixes: 712bae96631852 ("xfs: generalize the freespace and reserved blocks handling")
Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

--D

> ---
>  fs/xfs/xfs_super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b2dd0c0bf509..3be041647ec1 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1149,7 +1149,7 @@ xfs_init_percpu_counters(
>  	return 0;
>  
>  free_freecounters:
> -	while (--i > 0)
> +	while (--i >= 0)
>  		percpu_counter_destroy(&mp->m_free[i].count);
>  	percpu_counter_destroy(&mp->m_delalloc_rtextents);
>  free_delalloc:
> -- 
> 2.39.5 (Apple Git-154)
> 
> 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux