All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Wilfred Mallawa <wilfred.opensource@gmail.com>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Alistair Francis <alistair.francis@wdc.com>,
	Carlos Maiolino <cem@kernel.org>,
	Hans Holmberg <hans.holmberg@wdc.com>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	Wilfred Mallawa <wilfred.mallawa@wdc.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] xfs: fix memory leak on error in xfs_alloc_zone_info()
Date: Tue, 14 Apr 2026 05:58:18 +0200	[thread overview]
Message-ID: <91a63739-e905-4e45-aff0-53480de74e50@kernel.org> (raw)
In-Reply-To: <20260414034149.1116281-3-wilfred.opensource@gmail.com>

On 2026/04/14 5:41, Wilfred Mallawa wrote:
> From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> 
> 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 this while loop used

s/this/the

> in xfs_alloc_zone_info(). Fix it by allowing for the i == 0 case to be covered.

Please limit your commit message text to 74 chars per line.
(See Documentation/process/submitting-patches.rst, "The canonical patch format"
section).

> Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>

I think that the usual order here is to have the Fixes and CC tag before your
signed-off-by.

> Fixes: 080d01c41d44 ("xfs: implement zoned garbage collection")
> Cc: stable@vger.kernel.org

Other than this, looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> ---
>  fs/xfs/xfs_zone_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index a851b98143c0..c64f9ab743a6 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -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;


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-04-14  3:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  3:41 [PATCH] xfs: fix memory leak on error in xfs_alloc_zone_info() Wilfred Mallawa
2026-04-14  3:58 ` Damien Le Moal [this message]
2026-04-14 10:43 ` Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91a63739-e905-4e45-aff0-53480de74e50@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=alistair.francis@wdc.com \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wilfred.mallawa@wdc.com \
    --cc=wilfred.opensource@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.