ACK: [REGRESSION/bionic] ext4: fix false negatives *and* false positives in ext4_check_descriptors()
Colin Ian King
colin.king at canonical.com
Tue Jan 29 15:12:44 UTC 2019
On 29/01/2019 15:08, Stefan Bader wrote:
> From: Theodore Ts'o <tytso at mit.edu>
>
> BugLink: https://bugs.launchpad.net/bugs/1813727
>
> Ext4_check_descriptors() was getting called before s_gdb_count was
> initialized. So for file systems w/o the meta_bg feature, allocation
> bitmaps could overlap the block group descriptors and ext4 wouldn't
> notice.
>
> For file systems with the meta_bg feature enabled, there was a
> fencepost error which would cause the ext4_check_descriptors() to
> incorrectly believe that the block allocation bitmap overlaps with the
> block group descriptor blocks, and it would reject the mount.
>
> Fix both of these problems.
>
> Signed-off-by: Theodore Ts'o <tytso at mit.edu>
> Cc: stable at vger.kernel.org
>
> (cherry picked from commit 44de022c4382541cebdd6de4465d1f4f465ff1dd)
> Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
> ---
>
> This likely was introduced via upstream stable 2018-12-12
> e1d8355dd9508466024730813a84c8ee386d7b65.
>
> fs/ext4/super.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 6503bbac60cb..4288dede4c69 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2328,7 +2328,7 @@ static int ext4_check_descriptors(struct super_block *sb,
> struct ext4_sb_info *sbi = EXT4_SB(sb);
> ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
> ext4_fsblk_t last_block;
> - ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1;
> + ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0);
> ext4_fsblk_t block_bitmap;
> ext4_fsblk_t inode_bitmap;
> ext4_fsblk_t inode_table;
> @@ -4083,14 +4083,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
> goto failed_mount2;
> }
> }
> + sbi->s_gdb_count = db_count;
> if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {
> ext4_msg(sb, KERN_ERR, "group descriptors corrupted!");
> ret = -EFSCORRUPTED;
> goto failed_mount2;
> }
>
> - sbi->s_gdb_count = db_count;
> -
> timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
>
> /* Register extent status tree shrinker */
>
Clean cherry pick, addresses the issue fine.
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the kernel-team
mailing list