ext4: fix false negatives *and* false positives in ext4_check_descriptors()
authorTheodore Ts'o <tytso@mit.edu>
Sun, 8 Jul 2018 23:35:02 +0000 (19:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Aug 2018 10:16:38 +0000 (12:16 +0200)
commitdd69abaccbf78ba645ba46604a59b944695a2cb8
tree723db496045178302aeac2eaefb95eedba415870
parent09901e570c9e9d6bf302716edd3a5a14417a0657
ext4: fix false negatives *and* false positives in ext4_check_descriptors()

commit 44de022c4382541cebdd6de4465d1f4f465ff1dd upstream.

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@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Gilbert <bgilbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c