Re: [syzbot] [hfs?] memory leak in __hfs_bnode_create
From: Edward Adam Davis
Date: Fri Apr 17 2026 - 00:52:24 EST
#syz test
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index f8b5a8ae58ff..05287716afd8 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -604,7 +604,10 @@ struct hfs_bnode *hfs_bnode_find(struct hfs_btree *tree, u32 num)
node_error:
set_bit(HFS_BNODE_ERROR, &node->flags);
- clear_bit(HFS_BNODE_NEW, &node->flags);
+ if (test_bit(HFS_BNODE_NEW, &node->flags)) {
+ hfs_bnode_free(node);
+ return ERR_PTR(-EIO);
+ }
wake_up(&node->lock_wq);
hfs_bnode_put(node);
return ERR_PTR(-EIO);