hfs: fix coverity-found null deref
authorEric Sandeen <sandeen@redhat.com>
Thu, 17 Jan 2008 23:21:09 +0000 (15:21 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 17 Jan 2008 23:38:58 +0000 (15:38 -0800)
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>
fs/hfs/btree.c

index 31284c77bba87b8a393d5cc78789cd13f2e02b31..110dd3515dc89b27e226a9a65867f338df18de69 100644 (file)
@@ -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));
@@ -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;
 }