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

[PATCH] d_alloc_root() fixes: efs

 - inode leak on d_alloc_root() failure
parent 7573737d
...@@ -210,6 +210,7 @@ int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -210,6 +210,7 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
{ {
struct efs_sb_info *sb; struct efs_sb_info *sb;
struct buffer_head *bh; struct buffer_head *bh;
struct inode *root;
sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL); sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
if (!sb) if (!sb)
...@@ -266,10 +267,12 @@ int efs_fill_super(struct super_block *s, void *d, int silent) ...@@ -266,10 +267,12 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
s->s_flags |= MS_RDONLY; s->s_flags |= MS_RDONLY;
} }
s->s_op = &efs_superblock_operations; s->s_op = &efs_superblock_operations;
s->s_root = d_alloc_root(iget(s, EFS_ROOTINODE)); root = iget(s, EFS_ROOTINODE);
s->s_root = d_alloc_root(root);
if (!(s->s_root)) { if (!(s->s_root)) {
printk(KERN_ERR "EFS: get root inode failed\n"); printk(KERN_ERR "EFS: get root inode failed\n");
iput(root);
goto out_no_fs; goto out_no_fs;
} }
......
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