[PATCH][for stable 5.{15, 10} 0/4] ext4: Fix kernel BUG in ext4_free_blocks

From: Tudor Ambarus
Date: Thu Mar 02 2023 - 10:36:31 EST


Hi,

This patch set is intended for stable/linux-5.{15, 10}.y. The patches
applied cleanly without deviations from the original upstream patches.
The last patch is fixing the bug reported at [1]. The other three are
prerequisites for the last commit. I tested the patches and I confirm
that the reproducer no longer complains on linux-5.{15, 10}.y. Older
LTS kernels have more dependencies, let's fix these until I sort out
what else should be backported for the older LTS kernels.

[1] LINK: https://syzkaller.appspot.com/bug?id=5266d464285a03cee9dbfda7d2452a72c3c2ae7c

Cheers,
ta

Lukas Czerner (1):
ext4: block range must be validated before use in ext4_mb_clear_bb()

Ritesh Harjani (3):
ext4: refactor ext4_free_blocks() to pull out ext4_mb_clear_bb()
ext4: add ext4_sb_block_valid() refactored out of
ext4_inode_block_valid()
ext4: add strict range checks while freeing blocks

fs/ext4/block_validity.c | 26 +++--
fs/ext4/ext4.h | 3 +
fs/ext4/mballoc.c | 205 +++++++++++++++++++++++----------------
3 files changed, 139 insertions(+), 95 deletions(-)

--
2.40.0.rc0.216.gc4246ad0f0-goog