Re: [syzbot] [hfs?] memory leak in __hfs_bnode_create

From: Edward Adam Davis

Date: Fri Apr 17 2026 - 01:07:03 EST


#syz test

diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index f8b5a8ae58ff..cde9f6fbedd7 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -604,6 +604,13 @@ struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num)

node_error:
set_bit(HFS_BNODE_ERROR, &node->flags);
+ if (test_bit(HFS_BNODE_NEW, &node->flags)) {
+ if (num == HFSPLUS_TREE_HEAD) {
+ hfs_bnode_unhash(node);
+ hfs_bnode_free(node);
+ return ERR_PTR(-EIO);
+ }
+ }
clear_bit(HFS_BNODE_NEW, &node->flags);
wake_up(&node->lock_wq);
hfs_bnode_put(node);