[PATCH 24/30] ocfs2: check dinode suballoc bit in online filecheck
From: Joseph Qi
Date: Thu Nov 05 2026 - 04:58:34 EST
Wire the suballoc bit range predicate into the filecheck validator. A
suballocator group bitmap lives in a single block, so a bit at or beyond
ocfs2_suballoc_bits_per_block() can never be valid; accepting it would
later trip the BUG_ON() in _ocfs2_free_suballoc_bits() when the inode is
deleted.
Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
---
fs/ocfs2/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 7cde33f0f616..0c515ba37ea0 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -2036,6 +2036,15 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
goto bail;
}
+ if (ocfs2_dinode_has_bad_suballoc_bit(sb, di)) {
+ mlog(ML_ERROR,
+ "Filecheck: invalid dinode #%llu: suballoc bit %u\n",
+ (unsigned long long)bh->b_blocknr,
+ le16_to_cpu(di->i_suballoc_bit));
+ rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
+ goto bail;
+ }
+
if (!ocfs2_valid_inode_mode(le16_to_cpu(di->i_mode))) {
mlog(ML_ERROR,
"Filecheck: invalid dinode #%llu: mode 0%o has unknown file type\n",
--
2.39.3