From 9c9b11ce6df06053deac4095f9b346049cb6031c Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 28 Jan 2008 23:58:27 -0500 Subject: [PATCH] --- yaml --- r: 77890 b: refs/heads/master c: e7c95593001cb96ef5dd121a4523286c574c7133 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ext4/super.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 147d95c059ba..8e8236a98bf0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 07620f69eff6671fea6bd382c95709f757e33768 +refs/heads/master: e7c95593001cb96ef5dd121a4523286c574c7133 diff --git a/trunk/fs/ext4/super.c b/trunk/fs/ext4/super.c index 1484a087bba0..32e3ecb35cd7 100644 --- a/trunk/fs/ext4/super.c +++ b/trunk/fs/ext4/super.c @@ -1997,6 +1997,17 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) if (EXT4_BLOCKS_PER_GROUP(sb) == 0) goto cantfind_ext4; + + /* ensure blocks_count calculation below doesn't sign-extend */ + if (ext4_blocks_count(es) + EXT4_BLOCKS_PER_GROUP(sb) < + le32_to_cpu(es->s_first_data_block) + 1) { + printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu, " + "first data block %u, blocks per group %lu\n", + ext4_blocks_count(es), + le32_to_cpu(es->s_first_data_block), + EXT4_BLOCKS_PER_GROUP(sb)); + goto failed_mount; + } blocks_count = (ext4_blocks_count(es) - le32_to_cpu(es->s_first_data_block) + EXT4_BLOCKS_PER_GROUP(sb) - 1);