Skip to content

Commit

Permalink
hfs: fix coverity-found null deref
Browse files Browse the repository at this point in the history
Fix potential null deref introduced by commit
cf05946
http://bugzilla.kernel.org/show_bug.cgi?id=9748

Signed-off-by: Eric Sandeen <[email protected]>
Cc: Roman Zippel <[email protected]>
Reported-by: Adrian Bunk <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Jan 17, 2008
1 parent 6915719 commit 46a39c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/hfs/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
mapping = tree->inode->i_mapping;
page = read_mapping_page(mapping, 0, NULL);
if (IS_ERR(page))
goto free_tree;
goto free_inode;

/* Load the header */
head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc));
Expand Down Expand Up @@ -99,11 +99,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
page_cache_release(page);
return tree;

fail_page:
fail_page:
page_cache_release(page);
free_tree:
free_inode:
tree->inode->i_mapping->a_ops = &hfs_aops;
iput(tree->inode);
free_tree:
kfree(tree);
return NULL;
}
Expand Down

0 comments on commit 46a39c1

Please sign in to comment.