Skip to content

Commit 3cc0658

Browse files
author
Al Viro
committed
hppfs: fix dentry leak
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 0577d1b commit 3cc0658

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎fs/hppfs/hppfs.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
174174
err = -ENOMEM;
175175
inode = get_inode(ino->i_sb, proc_dentry);
176176
if (!inode)
177-
goto out_dput;
177+
goto out;
178178

179179
d_add(dentry, inode);
180180
return NULL;
181181

182-
out_dput:
183-
dput(proc_dentry);
184182
out:
185183
return ERR_PTR(err);
186184
}
@@ -690,8 +688,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
690688
struct inode *proc_ino = dentry->d_inode;
691689
struct inode *inode = new_inode(sb);
692690

693-
if (!inode)
691+
if (!inode) {
692+
dput(dentry);
694693
return ERR_PTR(-ENOMEM);
694+
}
695695

696696
if (S_ISDIR(dentry->d_inode->i_mode)) {
697697
inode->i_op = &hppfs_dir_iops;
@@ -704,7 +704,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
704704
inode->i_fop = &hppfs_file_fops;
705705
}
706706

707-
HPPFS_I(inode)->proc_dentry = dget(dentry);
707+
HPPFS_I(inode)->proc_dentry = dentry;
708708

709709
inode->i_uid = proc_ino->i_uid;
710710
inode->i_gid = proc_ino->i_gid;
@@ -737,7 +737,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
737737
sb->s_fs_info = proc_mnt;
738738

739739
err = -ENOMEM;
740-
root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root);
740+
root_inode = get_inode(sb, dget(proc_mnt->mnt_sb->s_root));
741741
if (!root_inode)
742742
goto out_mntput;
743743

0 commit comments

Comments
 (0)