Skip to contentSkip to conversation

FAILED: patch "[PATCH] xfs: fix memory leak for data allocated by" failed to apply to 7.0-stable tree

PATCH [email protected] 1 participant 1 message May 20

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 7.0-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.0.y
git checkout FETCH_HEAD
git cherry-pick -x af47a4be6a90c8bfc874f9994ac9c15813b9718b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026052036-capped-deluge-ab83@gregkh' --subject-prefix 'PATCH 7.0.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From af47a4be6a90c8bfc874f9994ac9c15813b9718b Mon Sep 17 00:00:00 2001
From: Wilfred Mallawa <[email protected]>
Date: Fri, 17 Apr 2026 12:16:30 +1000
Subject: [PATCH] xfs: fix memory leak for data allocated by
xfs_zone_gc_data_alloc()

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")
fs/xfs/xfs_zone_gc.c +1 -1
index fedcc47048af..c8a1d5c0332c 100644
@@ -1221,7 +1221,7 @@ out_put_oz:
 	if (data->oz)
 		xfs_open_zone_put(data->oz);
 out_free_gc_data:
-	kfree(data);
+	xfs_zone_gc_data_free(data);
 	return error;
 }