]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: scrub: unlock dquot before early return in quota scrub
authorhongao <hongao@uniontech.com>
Thu, 12 Mar 2026 12:10:26 +0000 (20:10 +0800)
committerCarlos Maiolino <cem@kernel.org>
Wed, 18 Mar 2026 08:44:46 +0000 (09:44 +0100)
xchk_quota_item can return early after calling xchk_fblock_process_error.
When that helper returns false, the function returned immediately without
dropping dq->q_qlock, which can leave the dquot lock held and risk lock
leaks or deadlocks in later quota operations.

Fix this by unlocking dq->q_qlock before the early return.

Signed-off-by: hongao <hongao@uniontech.com>
Fixes: 7d1f0e167a067e ("xfs: check the ondisk space mapping behind a dquot")
Cc: <stable@vger.kernel.org> # v6.8
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/quota.c

index 1d25bd5b892e0f51e1d3920c61177b39de25bab6..222812fe202c21f226243fb819fcadc3388608ba 100644 (file)
@@ -171,8 +171,10 @@ xchk_quota_item(
 
        error = xchk_quota_item_bmap(sc, dq, offset);
        xchk_iunlock(sc, XFS_ILOCK_SHARED);
-       if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, offset, &error))
+       if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, offset, &error)) {
+               mutex_unlock(&dq->q_qlock);
                return error;
+       }
 
        /*
         * Warn if the hard limits are larger than the fs.