mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
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>
This commit is contained in:
parent
e44543b83b
commit
0f2ddca66d
1 changed files with 9 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue