]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt
authorBaokun Li <libaokun1@huawei.com>
Thu, 4 Jan 2024 14:20:37 +0000 (22:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:50 +0000 (13:34 +0100)
commitf32d2a745b02123258026e105a008f474f896d6a
tree7b2cf26504916603ebf9083903d9a2c14795f44c
parent720751b57f0ad6b1e0e9f78a484093d17b3186be
ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt

[ Upstream commit 993bf0f4c393b3667830918f9247438a8f6fdb5b ]

Determine if bb_fragments is 0 instead of determining bb_free to eliminate
the risk of dividing by zero when the block bitmap is corrupted.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240104142040.2835097-6-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/mballoc.c