From: Theodore Ts'o Date: Fri, 29 Jun 2018 15:35:58 +0000 (-0400) Subject: e2fsck: if user declines to fix s_inodes_acount, abort X-Git-Tag: v1.44.3-rc2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=867ffd4744899297961d952fa10f35225bd455b0;p=thirdparty%2Fe2fsprogs.git 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 --- diff --git a/e2fsck/super.c b/e2fsck/super.c index bfd100669..eb7ab0d1b 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -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 &&