projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2331fd4
)
ext4: avoid dividing by 0 in mb_update_avg_fragment_size() when block bitmap corrupt
author
Baokun Li
<libaokun1@huawei.com>
Thu, 4 Jan 2024 14:20:37 +0000
(22:20 +0800)
committer
Theodore Ts'o
<tytso@mit.edu>
Thu, 18 Jan 2024 15:50:24 +0000
(10:50 -0500)
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
patch
|
blob
|
history
diff --git
a/fs/ext4/mballoc.c
b/fs/ext4/mballoc.c
index fa351aa323dcf2ec4a3ce8ddb687eca62aa9a70a..751e31df0f10477d66a4004d56d94b24ee8056e7 100644
(file)
--- a/
fs/ext4/mballoc.c
+++ b/
fs/ext4/mballoc.c
@@
-842,7
+842,7
@@
mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp)
struct ext4_sb_info *sbi = EXT4_SB(sb);
int new_order;
- if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_fr
ee
== 0)
+ if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_fr
agments
== 0)
return;
new_order = mb_avg_fragment_size_order(sb,