diff options
-rw-r--r-- | fs/ext4/super.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1484a087bba0..32e3ecb35cd7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1997,6 +1997,17 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1997 | 1997 | ||
1998 | if (EXT4_BLOCKS_PER_GROUP(sb) == 0) | 1998 | if (EXT4_BLOCKS_PER_GROUP(sb) == 0) |
1999 | goto cantfind_ext4; | 1999 | goto cantfind_ext4; |
2000 | |||
2001 | /* ensure blocks_count calculation below doesn't sign-extend */ | ||
2002 | if (ext4_blocks_count(es) + EXT4_BLOCKS_PER_GROUP(sb) < | ||
2003 | le32_to_cpu(es->s_first_data_block) + 1) { | ||
2004 | printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu, " | ||
2005 | "first data block %u, blocks per group %lu\n", | ||
2006 | ext4_blocks_count(es), | ||
2007 | le32_to_cpu(es->s_first_data_block), | ||
2008 | EXT4_BLOCKS_PER_GROUP(sb)); | ||
2009 | goto failed_mount; | ||
2010 | } | ||
2000 | blocks_count = (ext4_blocks_count(es) - | 2011 | blocks_count = (ext4_blocks_count(es) - |
2001 | le32_to_cpu(es->s_first_data_block) + | 2012 | le32_to_cpu(es->s_first_data_block) + |
2002 | EXT4_BLOCKS_PER_GROUP(sb) - 1); | 2013 | EXT4_BLOCKS_PER_GROUP(sb) - 1); |