e2fsck: if user declines to fix s_inodes_acount, abort
A recent commit, d74eb7ef: "e2fsck: handle s_inodes_count corruption
properly" tries to fix s_inodes_count. However, if the user declines
to fix the invalid s_inodes_count, e2fsck needs to abort since
otherwise we can crash due to the insane s_inodes_count.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/e2fsck/super.c b/e2fsck/super.c
index bfd1006..eb7ab0d 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -676,6 +676,12 @@
if (fix_problem(ctx, PR_0_INODE_COUNT_WRONG, &pctx)) {
sb->s_inodes_count = should_be;
ext2fs_mark_super_dirty(fs);
+ } else {
+ pctx.num = sb->s_inodes_count;
+ pctx.str = "inodes_count";
+ fix_problem(ctx, PR_0_MISC_CORRUPT_SUPER, &pctx);
+ ctx->flags |= E2F_FLAG_ABORT;
+ return;
}
}
if (sb->s_rev_level > EXT2_GOOD_OLD_REV &&