fs/ocfs2/suballoc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 939f15e640f193616691d3bcde0089760e75b0d3
Signed-off-by: Prithvi Tambewagh <activprithvi@gmail.com>
---
fs/ocfs2/suballoc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 6ac4dcd54588..c310345b7135 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -1992,6 +1992,14 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
}
cl = (struct ocfs2_chain_list *) &fe->id2.i_chain;
+ if (!le16_to_cpu(cl->cl_next_free_rec) ||
+ le16_to_cpu(cl->cl_next_free_rec) > le16_to_cpu(cl->cl_count)) {
+ status = ocfs2_error(ac->ac_inode->i_sb,
+ "Chain allocator dinode %llu has invalid next "
+ "free chain record %u, but only %u total\n",
+ (unsigned long long)le64_to_cpu(fe->i_blkno),
+ le16_to_cpu(cl->cl_next_free_rec),
+ le16_to_cpu(cl->cl_count));
victim = ocfs2_find_victim_chain(cl);
ac->ac_chain = victim;
base-commit: 939f15e640f193616691d3bcde0089760e75b0d3
--
2.34.1
Hello, syzbot tried to test the proposed patch but the build/boot failed: fs/ocfs2/suballoc.c:2082:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2116:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2143:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2152:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2215:1: error: function definition is not allowed here :2289:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2330:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2345:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2364:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2392:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2463:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2479:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2562:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2631:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2640:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2658:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2700:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2715:1: error: function definition is not allowed here fs/ocfs2/suballoc.c:2736:1: error: function definition is not allowed here Tested on: commit: 939f15e6 Merge tag 'turbostat-2025.06.08' of git://git.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel config: https://syzkaller.appspot.com/x/.config?x=d9ebb51ccc2ec42f dashboard link: https://syzkaller.appspot.com/bug?extid=96d38c6e1655c1420a72 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=12782512580000
© 2016 - 2025 Red Hat, Inc.