Commit 268378b6 authored by hongao's avatar hongao Committed by Carlos Maiolino
Browse files

xfs: scrub: unlock dquot before early return in quota scrub



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: default avatarhongao <hongao@uniontech.com>
Fixes: 7d1f0e16 ("xfs: check the ondisk space mapping behind a dquot")
Cc: <stable@vger.kernel.org> # v6.8
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 7cac6094
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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.