* Patch "ext4: use more strict checks for inodes_per_block on mount" has been added to the 4.4-stable tree
@ 2017-01-04 10:06 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-04 10:06 UTC (permalink / raw)
To: tytso, adilger, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
ext4: use more strict checks for inodes_per_block on mount
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ext4-use-more-strict-checks-for-inodes_per_block-on-mount.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From cd6bb35bf7f6d7d922509bf50265383a0ceabe96 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Fri, 18 Nov 2016 13:28:30 -0500
Subject: ext4: use more strict checks for inodes_per_block on mount
From: Theodore Ts'o <tytso@mit.edu>
commit cd6bb35bf7f6d7d922509bf50265383a0ceabe96 upstream.
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@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/ext4/super.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3496,12 +3496,16 @@ static int ext4_fill_super(struct super_
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);
@@ -3584,13 +3588,6 @@ static int ext4_fill_super(struct super_
}
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);
Patches currently in stable-queue which might be from tytso@mit.edu are
queue-4.4/ext4-reject-inodes-with-negative-size.patch
queue-4.4/ext4-fix-in-superblock-mount-options-processing.patch
queue-4.4/ext4-fix-mballoc-breakage-with-64k-block-size.patch
queue-4.4/ext4-do-not-perform-data-journaling-when-data-is-encrypted.patch
queue-4.4/ext4-use-more-strict-checks-for-inodes_per_block-on-mount.patch
queue-4.4/ext4-add-sanity-checking-to-count_overhead.patch
queue-4.4/ext4-return-enomem-instead-of-success.patch
queue-4.4/ext4-fix-stack-memory-corruption-with-64k-block-size.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-04 10:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-04 10:06 Patch "ext4: use more strict checks for inodes_per_block on mount" has been added to the 4.4-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).