projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a00b482
)
ext4: add extra check in ext4_mb_mark_bb() to prevent against possible corruption
author
Ritesh Harjani
<riteshh@linux.ibm.com>
Wed, 16 Feb 2022 07:02:51 +0000
(12:32 +0530)
committer
Theodore Ts'o
<tytso@mit.edu>
Sat, 26 Feb 2022 02:34:56 +0000
(21:34 -0500)
This patch adds an extra checks in ext4_mb_mark_bb() function
to make sure we mark & report error if we were to mark/clear any
of the critical FS metadata specific bitmaps (&bail out) to prevent
from any accidental corruption.
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link:
https://lore.kernel.org/r/53cbb6f2573db162a57f935365050d8b1df202ee.1644992610.git.riteshh@linux.ibm.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 0a95bdb1e07ba16b9a3d672efdf9dd916d8a7e89..5f0bc6d0aabe09806cbeef78d1ce6705b0128b23 100644
(file)
--- a/
fs/ext4/mballoc.c
+++ b/
fs/ext4/mballoc.c
@@
-3918,6
+3918,14
@@
void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
EXT4_BLOCKS_PER_GROUP(sb) - EXT4_C2B(sbi, blkoff));
clen = EXT4_NUM_B2C(sbi, thisgrp_len);
+ if (!ext4_sb_block_valid(sb, NULL, block, thisgrp_len)) {
+ ext4_error(sb, "Marking blocks in system zone - "
+ "Block = %llu, len = %u",
+ block, thisgrp_len);
+ bitmap_bh = NULL;
+ break;
+ }
+
bitmap_bh = ext4_read_block_bitmap(sb, group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);