This is a note to let you know that I've just added the patch titled xfs: fix xfs_ifree() error handling to not leak perag ref to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-fix-xfs_ifree-error-handling-to-not-leak-perag-ref.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sat Sep 24 11:39:38 AM CEST 2022 From: Leah Rumancik <leah.rumancik@xxxxxxxxx> Date: Thu, 22 Sep 2022 08:15:00 -0700 Subject: xfs: fix xfs_ifree() error handling to not leak perag ref To: stable@xxxxxxxxxxxxxxx Cc: linux-xfs@xxxxxxxxxxxxxxx, amir73il@xxxxxxxxx, chandan.babu@xxxxxxxxxx, Brian Foster <bfoster@xxxxxxxxxx>, "Darrick J . Wong" <djwong@xxxxxxxxxx>, Dave Chinner <dchinner@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Leah Rumancik <leah.rumancik@xxxxxxxxx> Message-ID: <20220922151501.2297190-3-leah.rumancik@xxxxxxxxx> From: Brian Foster <bfoster@xxxxxxxxxx> [ Upstream commit 6f5097e3367a7c0751e165e4c15bc30511a4ba38 ] For some reason commit 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree") replaced a jump to the exit path in the event of an xfs_difree() error with a direct return, which skips releasing the perag reference acquired at the top of the function. Restore the original code to drop the reference on error. Fixes: 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree") Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx> Signed-off-by: Leah Rumancik <leah.rumancik@xxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2634,7 +2634,7 @@ xfs_ifree( */ error = xfs_difree(tp, pag, ip->i_ino, &xic); if (error) - return error; + goto out; error = xfs_iunlink_remove(tp, pag, ip); if (error) Patches currently in stable-queue which might be from leah.rumancik@xxxxxxxxx are queue-5.15/xfs-fix-xfs_ifree-error-handling-to-not-leak-perag-ref.patch queue-5.15/xfs-reorder-iunlink-remove-operation-in-xfs_ifree.patch queue-5.15/xfs-validate-inode-fork-size-against-fork-format.patch