From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Eric Sesterhenn <snakebyte@gmx.de>, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] e2fsck: Add superblock check to make sure s_first_ino is valid
Date: Thu, 22 Jan 2009 16:33:01 -0500 [thread overview]
Message-ID: <1232659984-10183-1-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <20090122211224.GJ14966@mit.edu>
An deliberately corrupted filesystem with an insanely large
s_first_ino field could cause e2fsck to crash with a seg fault.
Thanks to Eric Sesterhenn for supplying test cases which demonstrated
this issue.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
e2fsck/super.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index cd2b9f0..24ec7a8 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -513,6 +513,10 @@ void check_super_block(e2fsck_t ctx)
check_super_value(ctx, "reserved_gdt_blocks",
sb->s_reserved_gdt_blocks, MAX_CHECK, 0,
fs->blocksize/4);
+ if (sb->s_rev_level > EXT2_GOOD_OLD_REV)
+ check_super_value(ctx, "first_ino", sb->s_first_ino,
+ MIN_CHECK | MAX_CHECK,
+ EXT2_GOOD_OLD_FIRST_INO, sb->s_inodes_count);
inode_size = EXT2_INODE_SIZE(sb);
check_super_value(ctx, "inode_size",
inode_size, MIN_CHECK | MAX_CHECK,
--
1.6.0.4.8.g36f27.dirty
next prev parent reply other threads:[~2009-01-22 21:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-22 8:56 (unknown) Eric Sesterhenn
2009-01-22 11:12 ` e2fsck faults with corrupted images Eric Sesterhenn
2009-01-22 21:12 ` Theodore Tso
2009-01-22 21:32 ` [PATCH] e2fsck: Add superblock check to make sure s_first_ino is valid Theodore Ts'o
2009-01-22 21:32 ` [PATCH] ext2fs_new_inode(): Add sanity check to assure a valid inode number Theodore Ts'o
2009-01-22 21:32 ` [PATCH] libext2fs: Add sanity checks to ext2fs_{block,inode}_alloc_stats Theodore Ts'o
2009-01-22 21:32 ` [PATCH] e2fsck: Change PR_3_CREATE_LPF_ERROR to be a non-fatal problem Theodore Ts'o
2009-01-22 21:33 ` Theodore Ts'o [this message]
2009-01-22 21:33 ` [PATCH] ext2fs_new_inode(): Add sanity check to assure a valid inode number Theodore Ts'o
2009-01-22 21:33 ` [PATCH] libext2fs: Add sanity checks to ext2fs_{block,inode}_alloc_stats Theodore Ts'o
2009-01-22 21:33 ` [PATCH] e2fsck: Change PR_3_CREATE_LPF_ERROR to be a non-fatal problem Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232659984-10183-1-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=snakebyte@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).