Commit fb09c373 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds

hfs: avoid crash in hfs_bnode_create

Commit 634725a9 ("hfs: cleanup HFS+ prints") removed the BUG_ON in
hfs_bnode_create in hfsplus.  This patch removes it from the hfs version
and avoids an fsfuzzer crash.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Acked-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 28ccddf7
...@@ -415,7 +415,11 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num) ...@@ -415,7 +415,11 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num)
spin_lock(&tree->hash_lock); spin_lock(&tree->hash_lock);
node = hfs_bnode_findhash(tree, num); node = hfs_bnode_findhash(tree, num);
spin_unlock(&tree->hash_lock); spin_unlock(&tree->hash_lock);
BUG_ON(node); if (node) {
pr_crit("new node %u already hashed?\n", num);
WARN_ON(1);
return node;
}
node = __hfs_bnode_create(tree, num); node = __hfs_bnode_create(tree, num);
if (!node) if (!node)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment