fs/ocfs2/inode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d76bb1ebb5587f66b0f8b8099bfbb44722bc08b3
Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
fs/ocfs2/inode.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 12e5d1f73325..f439dc801845 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -347,7 +347,12 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
} else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) {
/* we can't actually hit this as read_inode can't
* handle superblocks today ;-) */
- BUG();
+ ocfs2_error(sb,
+ "System Inode %llu has "
+ "OCFS2_SUPER_BLOCK_FL set",
+ (unsigned long long)le64_to_cpu(fe->i_blkno));
+ make_bad_inode(inode);
+ return;
}
switch (inode->i_mode & S_IFMT) {
@@ -555,6 +560,11 @@ static int ocfs2_read_locked_inode(struct inode *inode,
ocfs2_populate_inode(inode, fe, 0);
+ if (is_bad_inode(inode)) {
+ status = -EIO;
+ goto bail;
+ }
+
BUG_ON(args->fi_blkno != le64_to_cpu(fe->i_blkno));
if (buffer_dirty(bh) && !buffer_jbd(bh)) {
@@ -576,7 +586,7 @@ static int ocfs2_read_locked_inode(struct inode *inode,
if (can_lock)
ocfs2_inode_unlock(inode, lock_level);
- if (status < 0)
+ if (status < 0 && !is_bad_inode(inode))
make_bad_inode(inode);
brelse(bh);
base-commit: d76bb1ebb5587f66b0f8b8099bfbb44722bc08b3
--
2.43.0
Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-by: syzbot+779d072a1067a8b1a917@syzkaller.appspotmail.com Tested-by: syzbot+779d072a1067a8b1a917@syzkaller.appspotmail.com Tested on: commit: d76bb1eb Merge tag 'erofs-for-6.15-rc6-fixes' of git:/.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git console output: https://syzkaller.appspot.com/x/log.txt?x=1479e77c580000 kernel config: https://syzkaller.appspot.com/x/.config?x=b20d1657eb8978a6 dashboard link: https://syzkaller.appspot.com/bug?extid=779d072a1067a8b1a917 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 patch: https://syzkaller.appspot.com/x/patch.diff?x=13c41d92580000 Note: testing is done by a robot and is best-effort only.
© 2016 - 2025 Red Hat, Inc.