Re: [syzbot] [hfs?] KASAN: out-of-bounds Read in hfs_bnode_move

From: Edward Adam Davis
Date: Thu Jul 24 2025 - 07:52:01 EST


#syz test

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index ef9498a6e88a..1d6f2bbafa7a 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -133,6 +133,8 @@ int hfs_brec_find(struct hfs_find_data *fd)
goto invalid;
if (bnode->type != (--height ? HFS_NODE_INDEX : HFS_NODE_LEAF))
goto invalid;
+ if (!bnode->num_recs)
+ goto invalid;
bnode->parent = parent;

res = __hfs_brec_find(bnode, fd);