|
Anthony Iliopoulos |
2b17a8 |
From 6f5097e3367a7c0751e165e4c15bc30511a4ba38 Mon Sep 17 00:00:00 2001
|
|
Anthony Iliopoulos |
2b17a8 |
From: Brian Foster <bfoster@redhat.com>
|
|
Anthony Iliopoulos |
2b17a8 |
Date: Mon, 30 May 2022 10:56:33 +1000
|
|
Anthony Iliopoulos |
2b17a8 |
Subject: [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref
|
|
Anthony Iliopoulos |
2b17a8 |
Git-commit: 6f5097e3367a7c0751e165e4c15bc30511a4ba38
|
|
Anthony Iliopoulos |
2b17a8 |
Patch-mainline: v5.19-rc1
|
|
Anthony Iliopoulos |
2b17a8 |
References: git-fixes
|
|
Anthony Iliopoulos |
2b17a8 |
|
|
Anthony Iliopoulos |
2b17a8 |
For some reason commit 9a5280b312e2e ("xfs: reorder iunlink remove
|
|
Anthony Iliopoulos |
2b17a8 |
operation in xfs_ifree") replaced a jump to the exit path in the
|
|
Anthony Iliopoulos |
2b17a8 |
event of an xfs_difree() error with a direct return, which skips
|
|
Anthony Iliopoulos |
2b17a8 |
releasing the perag reference acquired at the top of the function.
|
|
Anthony Iliopoulos |
2b17a8 |
Restore the original code to drop the reference on error.
|
|
Anthony Iliopoulos |
2b17a8 |
|
|
Anthony Iliopoulos |
2b17a8 |
Fixes: 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree")
|
|
Anthony Iliopoulos |
2b17a8 |
Signed-off-by: Brian Foster <bfoster@redhat.com>
|
|
Anthony Iliopoulos |
2b17a8 |
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
|
Anthony Iliopoulos |
2b17a8 |
Reviewed-by: Dave Chinner <dchinner@redhat.com>
|
|
Anthony Iliopoulos |
2b17a8 |
Signed-off-by: Dave Chinner <david@fromorbit.com>
|
|
Anthony Iliopoulos |
2b17a8 |
Acked-by: Anthony Iliopoulos <ailiop@suse.com>
|
|
Anthony Iliopoulos |
2b17a8 |
|
|
Anthony Iliopoulos |
2b17a8 |
---
|
|
Anthony Iliopoulos |
2b17a8 |
fs/xfs/xfs_inode.c | 2 +-
|
|
Anthony Iliopoulos |
2b17a8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Anthony Iliopoulos |
2b17a8 |
|
|
Anthony Iliopoulos |
2b17a8 |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
|
|
Anthony Iliopoulos |
2b17a8 |
index b2879870a17e..52d6f2c7d58b 100644
|
|
Anthony Iliopoulos |
2b17a8 |
--- a/fs/xfs/xfs_inode.c
|
|
Anthony Iliopoulos |
2b17a8 |
+++ b/fs/xfs/xfs_inode.c
|
|
Anthony Iliopoulos |
2b17a8 |
@@ -2622,7 +2622,7 @@ xfs_ifree(
|
|
Anthony Iliopoulos |
2b17a8 |
*/
|
|
Anthony Iliopoulos |
2b17a8 |
error = xfs_difree(tp, pag, ip->i_ino, &xic;;
|
|
Anthony Iliopoulos |
2b17a8 |
if (error)
|
|
Anthony Iliopoulos |
2b17a8 |
- return error;
|
|
Anthony Iliopoulos |
2b17a8 |
+ goto out;
|
|
Anthony Iliopoulos |
2b17a8 |
|
|
Anthony Iliopoulos |
2b17a8 |
error = xfs_iunlink_remove(tp, pag, ip);
|
|
Anthony Iliopoulos |
2b17a8 |
if (error)
|
|
Anthony Iliopoulos |
2b17a8 |
--
|
|
Anthony Iliopoulos |
2b17a8 |
2.35.3
|
|
Anthony Iliopoulos |
2b17a8 |
|