Skip to content

Commit

Permalink
vfs: fix dentry leak in simple_fill_super()
Browse files Browse the repository at this point in the history
put dentry if inode allocation failed, d_genocide() cannot release it

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Konstantin Khlebnikov authored and Christoph Hellwig committed Nov 2, 2011
1 parent 994c0e9 commit 32096ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
if (!dentry)
goto out;
inode = new_inode(s);
if (!inode)
if (!inode) {
dput(dentry);
goto out;
}
inode->i_mode = S_IFREG | files->mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
inode->i_fop = files->ops;
Expand Down

0 comments on commit 32096ea

Please sign in to comment.