Commit 32096ea1 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Christoph Hellwig

vfs: fix dentry leak in simple_fill_super()

put dentry if inode allocation failed, d_genocide() cannot release it
Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 994c0e99
...@@ -510,8 +510,10 @@ int simple_fill_super(struct super_block *s, unsigned long magic, ...@@ -510,8 +510,10 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
if (!dentry) if (!dentry)
goto out; goto out;
inode = new_inode(s); inode = new_inode(s);
if (!inode) if (!inode) {
dput(dentry);
goto out; goto out;
}
inode->i_mode = S_IFREG | files->mode; inode->i_mode = S_IFREG | files->mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
inode->i_fop = files->ops; inode->i_fop = files->ops;
......
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