Commit 3cc0658e authored by Al Viro's avatar Al Viro

hppfs: fix dentry leak

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0577d1ba
...@@ -174,13 +174,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, ...@@ -174,13 +174,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
err = -ENOMEM; err = -ENOMEM;
inode = get_inode(ino->i_sb, proc_dentry); inode = get_inode(ino->i_sb, proc_dentry);
if (!inode) if (!inode)
goto out_dput; goto out;
d_add(dentry, inode); d_add(dentry, inode);
return NULL; return NULL;
out_dput:
dput(proc_dentry);
out: out:
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -690,8 +688,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) ...@@ -690,8 +688,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
struct inode *proc_ino = dentry->d_inode; struct inode *proc_ino = dentry->d_inode;
struct inode *inode = new_inode(sb); struct inode *inode = new_inode(sb);
if (!inode) if (!inode) {
dput(dentry);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
if (S_ISDIR(dentry->d_inode->i_mode)) { if (S_ISDIR(dentry->d_inode->i_mode)) {
inode->i_op = &hppfs_dir_iops; inode->i_op = &hppfs_dir_iops;
...@@ -704,7 +704,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) ...@@ -704,7 +704,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
inode->i_fop = &hppfs_file_fops; inode->i_fop = &hppfs_file_fops;
} }
HPPFS_I(inode)->proc_dentry = dget(dentry); HPPFS_I(inode)->proc_dentry = dentry;
inode->i_uid = proc_ino->i_uid; inode->i_uid = proc_ino->i_uid;
inode->i_gid = proc_ino->i_gid; inode->i_gid = proc_ino->i_gid;
...@@ -737,7 +737,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) ...@@ -737,7 +737,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
sb->s_fs_info = proc_mnt; sb->s_fs_info = proc_mnt;
err = -ENOMEM; err = -ENOMEM;
root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root); root_inode = get_inode(sb, dget(proc_mnt->mnt_sb->s_root));
if (!root_inode) if (!root_inode)
goto out_mntput; goto out_mntput;
......
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