Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref
@ 2022-05-27 13:34 Brian Foster
  2022-05-27 16:12 ` Darrick J. Wong
  2022-05-27 22:42 ` Dave Chinner
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Foster @ 2022-05-27 13:34 UTC (permalink / raw)
  To: linux-xfs

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@redhat.com>
---
 fs/xfs/xfs_inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index b2879870a17e..52d6f2c7d58b 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2622,7 +2622,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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-27 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-27 13:34 [PATCH] xfs: fix xfs_ifree() error handling to not leak perag ref Brian Foster
2022-05-27 16:12 ` Darrick J. Wong
2022-05-27 22:42 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox