]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: don't wrap around quota ids in dqiterate
authorDarrick J. Wong <djwong@kernel.org>
Tue, 14 Jul 2026 06:04:55 +0000 (23:04 -0700)
committerCarlos Maiolino <cem@kernel.org>
Tue, 14 Jul 2026 09:01:47 +0000 (11:01 +0200)
LOLLM noticed that q_id is an unsigned 32-bit variable.  If it happens
to be set to XFS_DQ_ID_MAX due to a filesystem that actually has a dquot
for ID_MAX, then this addition will truncate to zero and the iteration
starts over.  Fix this by casting to u64.

Cc: stable@vger.kernel.org # v6.8
Fixes: 21d7500929c8a0 ("xfs: improve dquot iteration for scrub")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/dqiterate.c

index 10950e4bd4c3c090a6d6d78df48b826e82334afa..079dc4e691a01a1c16652ba55526b62f2aed8d49 100644 (file)
@@ -205,7 +205,7 @@ xchk_dquot_iter(
        if (error)
                return error;
 
-       cursor->id = dq->q_id + 1;
+       cursor->id = (uint64_t)dq->q_id + 1;
        *dqpp = dq;
        return 1;
 }