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)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 18 Jan 2024 15:50:24 +0000 (10:50 -0500)
commit993bf0f4c393b3667830918f9247438a8f6fdb5b
treee5c9929fc1164ac0404405527dab201682e26801
parent2331fd4a49864e1571b4f50aa3aa1536ed6220d0
ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt

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>
fs/ext4/mballoc.c