From: Brian Foster Date: Thu, 22 Sep 2022 15:15:00 +0000 (-0700) Subject: xfs: fix xfs_ifree() error handling to not leak perag ref X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5caa3a12795383654bcb1272605801816c216726;p=linux.git xfs: fix xfs_ifree() error handling to not leak perag ref [ 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 Reviewed-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner Signed-off-by: Leah Rumancik Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 36bcdcf3bb78c..b2ea853182141 100644 --- 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)