Skip to content

Commit

Permalink
procfs: clean proc_fill_super() up
Browse files Browse the repository at this point in the history
First of all, there's no need to zero ->i_uid/->i_gid on root inode -
both had been set to zero already.  Moreover, let's take the iput()
on failure to the failure exit it belongs to...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Mar 21, 2012
1 parent be0d93f commit 6b4231e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/proc/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,15 @@ int proc_fill_super(struct super_block *s)
root_inode = proc_get_inode(s, &proc_root);
if (!root_inode)
goto out_no_root;
root_inode->i_uid = 0;
root_inode->i_gid = 0;
s->s_root = d_alloc_root(root_inode);
if (!s->s_root)
if (!s->s_root) {
iput(root_inode);
goto out_no_root;
}
return 0;

out_no_root:
printk("proc_read_super: get root inode failed\n");
iput(root_inode);
pde_put(&proc_root);
return -ENOMEM;
}

0 comments on commit 6b4231e

Please sign in to comment.