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