Whamcloud - gitweb
e2fsck: if user declines to fix s_inodes_acount, abort
authorTheodore Ts'o <tytso@mit.edu>
Fri, 29 Jun 2018 15:35:58 +0000 (11:35 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 29 Jun 2018 15:35:58 +0000 (11:35 -0400)
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>
e2fsck/super.c

index bfd1006..eb7ab0d 100644 (file)
@@ -676,6 +676,12 @@ void check_super_block(e2fsck_t ctx)
                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 &&