xfs: fix quotacheck dquot id overflow infinite loop
authorBrian Foster <bfoster@redhat.com>
Mon, 24 Jul 2017 15:33:25 +0000 (08:33 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 24 Jul 2017 15:33:25 +0000 (08:33 -0700)
If a dquot has an id of U32_MAX, the next lookup index increment
overflows the uint32_t back to 0. This starts the lookup sequence
over from the beginning, repeats indefinitely and results in a
livelock.

Update xfs_qm_dquot_walk() to explicitly check for the lookup
overflow and exit the loop.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_qm.c

index 6ce948c436d5f37029d49c2a1e974a5c75baed37..15751dc2a27df04a4608754ff8250de6ae8bd77f 100644 (file)
@@ -111,6 +111,9 @@ restart:
                        skipped = 0;
                        break;
                }
+               /* we're done if id overflows back to zero */
+               if (!next_index)
+                       break;
        }
 
        if (skipped) {