]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfs: fix xfs_ifree() error handling to not leak perag ref
authorBrian Foster <bfoster@redhat.com>
Mon, 30 May 2022 00:56:33 +0000 (10:56 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 30 May 2022 00:56:33 +0000 (10:56 +1000)
For some reason commit 50cc996c25f54 ("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: 50cc996c25f54 ("xfs: reorder iunlink remove operation in xfs_ifree")
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_inode.c

index b2879870a17e28b4cbc9e36767b0d73f0b0069e0..52d6f2c7d58b3722e6e28ecb15b9165ea56dda02 100644 (file)
@@ -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)