From: "Darrick J. Wong" <djwong@kernel.org>
To: Wilfred Mallawa <wilfred.opensource@gmail.com>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Carlos Maiolino <cem@kernel.org>,
Hans Holmberg <hans.holmberg@wdc.com>,
Wilfred Mallawa <wilfred.mallawa@wdc.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc()
Date: Fri, 17 Apr 2026 07:18:33 -0700 [thread overview]
Message-ID: <20260417141833.GA7751@frogsfrogsfrogs> (raw)
In-Reply-To: <20260417021628.2608734-3-wilfred.opensource@gmail.com>
On Fri, Apr 17, 2026 at 12:16:30PM +1000, Wilfred Mallawa wrote:
> From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
>
> In xfs_zone_gc_mount(), on error, a struct xfs_zone_gc_data allocated
> with xfs_zone_gc_data_alloc() is freed with kfree(), however, this
> doesn't free the underlying folios or the rmap_irecs.
>
> Use xfs_zone_gc_data_free() to correctly free this memory.
>
> Fixes: 080d01c41d44 ("xfs: implement zoned garbage collection")
> Cc: stable@vger.kernel.org
Cc: <stable@vger.kernel.org> # v6.15
[autobackport plz, I need all the help I can get]
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> ---
> fs/xfs/xfs_zone_gc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
> index e7b33d5a8b3d..2520e57e24a8 100644
> --- a/fs/xfs/xfs_zone_gc.c
> +++ b/fs/xfs/xfs_zone_gc.c
> @@ -1230,7 +1230,7 @@ xfs_zone_gc_mount(
> if (data->oz)
> xfs_open_zone_put(data->oz);
> out_free_gc_data:
> - kfree(data);
> + xfs_zone_gc_data_free(data);
> return error;
> }
>
> --
> 2.53.0
>
>
prev parent reply other threads:[~2026-04-17 14:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 2:16 [PATCH] xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc() Wilfred Mallawa
2026-04-17 7:51 ` Christoph Hellwig
2026-04-17 14:18 ` Darrick J. Wong [this message]
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=20260417141833.GA7751@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hans.holmberg@wdc.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox