]> git.hungrycats.org Git - linux/commitdiff
[PATCH] d_alloc_root() fixes: hfsplus
authorAlexander Viro <viro@www.linux.org.uk>
Thu, 4 Mar 2004 05:23:25 +0000 (21:23 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 4 Mar 2004 05:23:25 +0000 (21:23 -0800)
 - inode leak on d_alloc_root() failure

fs/hfsplus/super.c

index 3040a75bb781f47228dc235cafaf7a1c4bd22900..16e6dd8ca896f7db6b7d3e93f2c0f1872dbc80d3 100644 (file)
@@ -278,6 +278,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
        struct hfsplus_sb_info *sbi;
        hfsplus_cat_entry entry;
        struct hfs_find_data fd;
+       struct inode *root;
        struct qstr str;
        int err = -EINVAL;
 
@@ -364,10 +365,12 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        /* Load the root directory */
-       sb->s_root = d_alloc_root(iget(sb, HFSPLUS_ROOT_CNID));
+       root = iget(sb, HFSPLUS_ROOT_CNID);
+       sb->s_root = d_alloc_root(root);
        if (!sb->s_root) {
                if (!silent)
                        printk("HFS+-fs: failed to load root directory\n");
+               iput(root);
                goto cleanup;
        }