Skip to contentSkip to conversation

xfs: fix quotacheck dquot id overflow infinite loop

PATCH In review Brian Foster 2 participants 2 messages Jul 24, 2017 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix quotacheck dquot id overflow infinite loop

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.

---
 fs/xfs/xfs_qm.c | 3 +++
 1 file changed, 3 insertions(+)
fs/xfs/xfs_qm.c +3 -0
index 6ce948c..15751dc 100644
@@ -111,6 +111,9 @@ xfs_qm_dquot_walk(
 			skipped = 0;
 			break;
 		}
+		/* we're done if id overflows back to zero */
+		if (!next_index)
+			break;
 	}
 
 	if (skipped) {
Signature · 1 line
2.9.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Brian Foster

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.

--D

Quoted 25 lines
---
 fs/xfs/xfs_qm.c | 3 +++
 1 file changed, 3 insertions(+)
fs/xfs/xfs_qm.c +3 -0
index 6ce948c..15751dc 100644
@@ -111,6 +111,9 @@ xfs_qm_dquot_walk(
 			skipped = 0;
 			break;
 		}
+		/* we're done if id overflows back to zero */
+		if (!next_index)
+			break;
 	}
 
 	if (skipped) {
Signature · 6 lines
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html