Re: [syzbot] [hfs?] memory leak in __hfs_bnode_create
From: Edward Adam Davis
Date: Thu Apr 16 2026 - 23:11:43 EST
#syz test
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index 394542a47e60..926e4b40a065 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -270,7 +270,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
struct hfs_btree *tree;
struct hfs_btree_header_rec *head;
struct address_space *mapping;
- struct hfs_bnode *node;
+ struct hfs_bnode *node = NULL;
struct inode *inode;
struct page *page;
unsigned int size;
@@ -401,6 +401,8 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
put_page(page);
free_inode:
tree->inode->i_mapping->a_ops = &hfsplus_aops;
+ if (!IS_ERR_OR_NULL(node))
+ hfs_bnode_put(node);
iput(tree->inode);
free_tree:
kfree(tree);