diff options
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
| -rw-r--r-- | fs/ext4/super.c | 17 | 
2 files changed, 17 insertions, 1 deletions
| diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 282a51b07c57..a8a750f59621 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -235,6 +235,7 @@ struct ext4_io_submit {  #define	EXT4_MAX_BLOCK_SIZE		65536  #define EXT4_MIN_BLOCK_LOG_SIZE		10  #define EXT4_MAX_BLOCK_LOG_SIZE		16 +#define EXT4_MAX_CLUSTER_LOG_SIZE	30  #ifdef __KERNEL__  # define EXT4_BLOCK_SIZE(s)		((s)->s_blocksize)  #else diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 20da99da0a34..52b0530c5d65 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3565,7 +3565,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)  	if (blocksize < EXT4_MIN_BLOCK_SIZE ||  	    blocksize > EXT4_MAX_BLOCK_SIZE) {  		ext4_msg(sb, KERN_ERR, -		       "Unsupported filesystem blocksize %d", blocksize); +		       "Unsupported filesystem blocksize %d (%d log_block_size)", +			 blocksize, le32_to_cpu(es->s_log_block_size)); +		goto failed_mount; +	} +	if (le32_to_cpu(es->s_log_block_size) > +	    (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) { +		ext4_msg(sb, KERN_ERR, +			 "Invalid log block size: %u", +			 le32_to_cpu(es->s_log_block_size));  		goto failed_mount;  	} @@ -3697,6 +3705,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)  				 "block size (%d)", clustersize, blocksize);  			goto failed_mount;  		} +		if (le32_to_cpu(es->s_log_cluster_size) > +		    (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) { +			ext4_msg(sb, KERN_ERR, +				 "Invalid log cluster size: %u", +				 le32_to_cpu(es->s_log_cluster_size)); +			goto failed_mount; +		}  		sbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -  			le32_to_cpu(es->s_log_block_size);  		sbi->s_clusters_per_group = |