Skip to contentSkip to conversation

e2fsck: skip sorting extents if there are no valid extents

PATCH Applied Harshad Shirwadkar 2 participants 2 messages Nov 17, 2021 – Dec 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsck: skip sorting extents if there are no valid extents

From: Harshad Shirwadkar <[email protected]>

At the end of a fast commit replay, e2fsck tries merging extents in a inode. This patch fixes a bug in this logic where we were continuing this action even if there were no extents to merge resulting in accessing illegal memory.

---
 e2fsck/journal.c | 3 +++
 1 file changed, 3 insertions(+)
e2fsck/journal.c +3 -0
index fe4e018d..2e867234 100644
@@ -464,6 +464,9 @@ static void ex_sort_and_merge(struct extent_list *list)
 		}
 	}
 
+	if (list->count == 0)
+		return;
+
 	/* Now sort by logical offset */
 	qsort(list->extents, list->count, sizeof(list->extents[0]),
 		ex_compar);
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#1 lore raw
Quoted 8 lines · Harshad Shirwadkar

From: Harshad Shirwadkar <[email protected]>

At the end of a fast commit replay, e2fsck tries merging extents in a inode. This patch fixes a bug in this logic where we were continuing this action even if there were no extents to merge resulting in accessing illegal memory.

[...]

Applied, thanks!

[1/1] e2fsck: skip sorting extents if there are no valid extents

      commit: 54183fea07676d185b2c169c45a7c1adc7e3e26e

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>