Re: Syzbot test for fs: ocfs2: fix kernel BUG in ocfs2_find_victim_chain

From: Prithvi Tambewagh

Date: Sat Nov 29 2025 - 14:13:45 EST


#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 939f15e640f193616691d3bcde0089760e75b0d3

Signed-off-by: Prithvi Tambewagh <activprithvi@xxxxxxxxx>
---
fs/ocfs2/suballoc.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 6ac4dcd54588..c7eb6efc00b4 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -1993,6 +1993,13 @@ 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) == 0) {
+ status = ocfs2_error(ac->ac_inode->i_sb,
+ "Chain allocator dinode %llu has 0 chains\n",
+ (unsigned long long)le64_to_cpu(fe->i_blkno));
+ goto bail;
+ }
+
victim = ocfs2_find_victim_chain(cl);
ac->ac_chain = victim;


base-commit: 939f15e640f193616691d3bcde0089760e75b0d3
--
2.34.1