aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs/btree.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-01-17 18:21:09 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-17 18:38:58 -0500
commit46a39c1cd5d2f804b27e9a4be3fb1b510dda9570 (patch)
tree1f085f3303baa0f47feeb3b36d54e169bc5e210e /fs/hfs/btree.c
parent6915719b36a97d28fab576c6fa2a20364b435fe6 (diff)
hfs: fix coverity-found null deref
Fix potential null deref introduced by commit cf0594625083111ae522496dc1c256f7476939c2 http://bugzilla.kernel.org/show_bug.cgi?id=9748 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Cc: Roman Zippel <zippel@linux-m68k.org> Reported-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfs/btree.c')
-rw-r--r--fs/hfs/btree.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 31284c77bba8..110dd3515dc8 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
61 mapping = tree->inode->i_mapping; 61 mapping = tree->inode->i_mapping;
62 page = read_mapping_page(mapping, 0, NULL); 62 page = read_mapping_page(mapping, 0, NULL);
63 if (IS_ERR(page)) 63 if (IS_ERR(page))
64 goto free_tree; 64 goto free_inode;
65 65
66 /* Load the header */ 66 /* Load the header */
67 head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc)); 67 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 page_cache_release(page); 99 page_cache_release(page);
100 return tree; 100 return tree;
101 101
102 fail_page: 102fail_page:
103 page_cache_release(page); 103 page_cache_release(page);
104 free_tree: 104free_inode:
105 tree->inode->i_mapping->a_ops = &hfs_aops; 105 tree->inode->i_mapping->a_ops = &hfs_aops;
106 iput(tree->inode); 106 iput(tree->inode);
107free_tree:
107 kfree(tree); 108 kfree(tree);
108 return NULL; 109 return NULL;
109} 110}