]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: free xfs_busy_extents structure when no RT extents are queued
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Nov 2025 10:43:01 +0000 (05:43 -0500)
committerCarlos Maiolino <cem@kernel.org>
Thu, 6 Nov 2025 07:59:19 +0000 (08:59 +0100)
kmemleak occasionally reports leaking xfs_busy_extents structure
from xfs_scrub calls after running xfs/528 (but attributed to following
tests), which seems to be caused by not freeing the xfs_busy_extents
structure when tr.queued is 0 and xfs_trim_rtgroup_extents breaks out
of the main loop.  Free the structure in this case.

Fixes: a3315d11305f ("xfs: use rtgroup busy extent list for FITRIM")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_discard.c

index ee49f20875afa31a8958d8d0cb8cd56ca3f4f667..6917de8321915d6d87eb28eba0eb1c0fff168b13 100644 (file)
@@ -726,8 +726,10 @@ xfs_trim_rtgroup_extents(
                        break;
                }
 
-               if (!tr.queued)
+               if (!tr.queued) {
+                       kfree(tr.extents);
                        break;
+               }
 
                /*
                 * We hand the extent list to the discard function here so the