ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Tue, 21 Apr 2020 02:39:59 +0000 (19:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:31:15 +0000 (09:31 +0200)
commit319b553695ec9c83cd0453d137a434ca3abc26f1
tree6728cb5533afbf3fe1d7acd4643789e9cc156384
parent6de50456fe176caef211dc7a32ff16548c622665
ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max

commit c36a71b4e35ab35340facdd6964a00956b9fef0a upstream.

If eh->eh_max is 0, EXT_MAX_EXTENT/INDEX would evaluate to unsigned
(-1) resulting in illegal memory accesses. Although there is no
consistent repro, we see that generic/019 sometimes crashes because of
this bug.

Ran gce-xfstests smoke and verified that there were no regressions.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20200421023959.20879-2-harshadshirwadkar@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ext4_extents.h