Commit a828f4fd authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] d_alloc_root() fixes: hfsplus

 - inode leak on d_alloc_root() failure
parent 75b7de56
...@@ -278,6 +278,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) ...@@ -278,6 +278,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
struct hfsplus_sb_info *sbi; struct hfsplus_sb_info *sbi;
hfsplus_cat_entry entry; hfsplus_cat_entry entry;
struct hfs_find_data fd; struct hfs_find_data fd;
struct inode *root;
struct qstr str; struct qstr str;
int err = -EINVAL; int err = -EINVAL;
...@@ -364,10 +365,12 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) ...@@ -364,10 +365,12 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
} }
/* Load the root directory */ /* 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 (!sb->s_root) {
if (!silent) if (!silent)
printk("HFS+-fs: failed to load root directory\n"); printk("HFS+-fs: failed to load root directory\n");
iput(root);
goto cleanup; goto cleanup;
} }
......
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