Commit 1b56e3e5 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] d_alloc_root() fixes: adfs

 - leak of root inode if d_alloc_root() fails.
parent 5541952d
No related merge requests found
......@@ -333,6 +333,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
struct object_info root_obj;
unsigned char *b_data;
struct adfs_sb_info *asb;
struct inode *root;
asb = kmalloc(sizeof(*asb), GFP_KERNEL);
if (!asb)
......@@ -443,10 +444,11 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
asb->s_namelen = ADFS_F_NAME_LEN;
}
sb->s_root = d_alloc_root(adfs_iget(sb, &root_obj));
root = adfs_iget(sb, &root_obj);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
int i;
iput(root);
for (i = 0; i < asb->s_map_size; i++)
brelse(asb->s_map[i].dm_bh);
kfree(asb->s_map);
......
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