xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc()
Subsystems (2)
PATCH 1/1 xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc()
From: Wilfred Mallawa <[email protected]>
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.
--- fs/xfs/xfs_zone_gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_zone_gc.c +1 -1
@@ -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; }
Signature · 1 line
2.53.0
Quoted 7 lines · Wilfred Mallawa
From: Wilfred Mallawa <[email protected]>
In
xfs_zone_gc_mount(), on error, a structxfs_zone_gc_dataallocated withxfs_zone_gc_data_alloc()is freed withkfree(), however, this doesn't free the underlying folios or thermap_irecs.Use
xfs_zone_gc_data_free()to correctly free this memory.
Looks good:
Quoted 10 lines · Wilfred Mallawa
From: Wilfred Mallawa <[email protected]>
In
xfs_zone_gc_mount(), on error, a structxfs_zone_gc_dataallocated withxfs_zone_gc_data_alloc()is freed withkfree(), however, this doesn't free the underlying folios or thermap_irecs.Use
xfs_zone_gc_data_free()to correctly free this memory.Fixes 080d01c41d44 ("xfs: implement zoned garbage collection")
[autobackport plz, I need all the help I can get]
--D
Quoted 22 lines
Signed-off-by Wilfred Mallawa <[email protected]>--- fs/xfs/xfs_zone_gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_zone_gc.c +1
-1@@ -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; }Signature · 1 line
2.53.0
Quoted 8 lines · Wilfred Mallawa
In
xfs_zone_gc_mount(), on error, a structxfs_zone_gc_dataallocated withxfs_zone_gc_data_alloc()is freed withkfree(), however, this doesn't free the underlying folios or thermap_irecs.Use
xfs_zone_gc_data_free()to correctly free this memory.[...]
Applied to for-next, thanks!
[1/1] xfs: fix memory leak for data allocated by xfs_zone_gc_data_alloc()
commit: af47a4be6a90c8bfc874f9994ac9c15813b9718b
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>