summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2024-01-04 22:20:34 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-29 17:33:32 +0200
commit0a56dcce6b820a635208147bf7cd0697b285fbe2 (patch)
tree32a31f317500086c79d506f9db018420bedf49e7
parent5b7766ab913bd698031e85dcef53e35547e27a59 (diff)
ext4: do not trim the group with corrupted block bitmap
[ Upstream commit 172202152a125955367393956acf5f4ffd092e0d ] Otherwise operating on an incorrupted block bitmap can lead to all sorts of unknown problems. Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20240104142040.2835097-3-libaokun1@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/ext4/mballoc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index f55ab800a753..870397f3de55 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -6953,6 +6953,9 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
bool set_trimmed = false;
void *bitmap;
+ if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)))
+ return 0;
+
last = ext4_last_grp_cluster(sb, e4b->bd_group);
bitmap = e4b->bd_bitmap;
if (start == 0 && max >= last)