vfs: fix dentry leak in simple_fill_super()

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>
This commit is contained in:
Konstantin Khlebnikov 2011-11-01 16:12:33 +03:00 committed by Christoph Hellwig
parent 994c0e9925
commit 32096ea1aa
1 changed files with 3 additions and 1 deletions

View File

@ -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;