diff options
author | From: Thiemo Nagel <thiemo.nagel@ph.tum.de> | 2009-04-07 20:07:47 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-04-07 20:07:47 +0200 |
commit | 0f2ddca66d70c8ccba7486cf2d79c6b60e777abd (patch) | |
tree | 7d58c31ab30ba2b9e94780008a2083ac87f80db5 /fs/ext4 | |
parent | ext4: Fix off-by-one-error in ext4_valid_extent_idx() (diff) | |
download | linux-0f2ddca66d70c8ccba7486cf2d79c6b60e777abd.tar.xz linux-0f2ddca66d70c8ccba7486cf2d79c6b60e777abd.zip |
ext4: check block device size on mount
Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/super.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9987bba99db3..2958f4e6f222 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2508,6 +2508,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (EXT4_BLOCKS_PER_GROUP(sb) == 0) goto cantfind_ext4; + /* check blocks count against device size */ + blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; + if (blocks_count && ext4_blocks_count(es) > blocks_count) { + printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu " + "exceeds size of device (%llu blocks)\n", + ext4_blocks_count(es), blocks_count); + goto failed_mount; + } + /* * It makes no sense for the first data block to be beyond the end * of the filesystem. |