[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <EAD114AF-8586-437B-9EE3-E21FAF89E11B@dilger.ca>
Date: Fri, 18 Nov 2016 02:42:57 -0700
From: Andreas Dilger <adilger@...ger.ca>
To: Theodore Ts'o <tytso@....edu>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>, kernel@...p.com,
bp@...en8.de, stable@...r.kernel.org
Subject: Re: [PATCH 3/3] ext4: use more strict checks for inodes_per_block on mount
On Nov 17, 2016, at 9:26 PM, Theodore Ts'o <tytso@....edu> wrote:
>
> Centralize the checks for inodes_per_block and be more strict to make
> sure the inodes_per_block_group can't end up being zero.
>
> Signed-off-by: Theodore Ts'o <tytso@....edu>
Reviewed-by: Andreas Dilger <adilger@...ger.ca>
> Cc: stable@...r.kernel.org
> ---
> fs/ext4/super.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 3009c03220d6..6638a0415997 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3666,12 +3666,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>
> sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
> sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
> - if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0)
> - goto cantfind_ext4;
>
> sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
> if (sbi->s_inodes_per_block == 0)
> goto cantfind_ext4;
> + if (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||
> + sbi->s_inodes_per_group > blocksize * 8) {
> + ext4_msg(sb, KERN_ERR, "invalid inodes per group: %lu\n",
> + sbi->s_blocks_per_group);
> + goto failed_mount;
> + }
> sbi->s_itb_per_group = sbi->s_inodes_per_group /
> sbi->s_inodes_per_block;
> sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
> @@ -3754,13 +3758,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
> }
> sbi->s_cluster_ratio = clustersize / blocksize;
>
> - if (sbi->s_inodes_per_group > blocksize * 8) {
> - ext4_msg(sb, KERN_ERR,
> - "#inodes per group too big: %lu",
> - sbi->s_inodes_per_group);
> - goto failed_mount;
> - }
> -
> /* Do we have standard group size of clustersize * 8 blocks ? */
> if (sbi->s_blocks_per_group == clustersize << 3)
> set_opt2(sb, STD_GROUP_SIZE);
> --
> 2.11.0.rc0.7.gbe5a750
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists