Commit 46a39c1c authored by Eric Sandeen's avatar Eric Sandeen Committed by Linus Torvalds

hfs: fix coverity-found null deref

Fix potential null deref introduced by commit
cf059462
http://bugzilla.kernel.org/show_bug.cgi?id=9748Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Reported-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6915719b
...@@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke ...@@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
mapping = tree->inode->i_mapping; mapping = tree->inode->i_mapping;
page = read_mapping_page(mapping, 0, NULL); page = read_mapping_page(mapping, 0, NULL);
if (IS_ERR(page)) if (IS_ERR(page))
goto free_tree; goto free_inode;
/* Load the header */ /* Load the header */
head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc)); head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc));
...@@ -99,11 +99,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke ...@@ -99,11 +99,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
page_cache_release(page); page_cache_release(page);
return tree; return tree;
fail_page: fail_page:
page_cache_release(page); page_cache_release(page);
free_tree: free_inode:
tree->inode->i_mapping->a_ops = &hfs_aops; tree->inode->i_mapping->a_ops = &hfs_aops;
iput(tree->inode); iput(tree->inode);
free_tree:
kfree(tree); kfree(tree);
return NULL; return NULL;
} }
......
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