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>
diff --git a/fs/libfs.c b/fs/libfs.c
index c18e9a1..a2c0029 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -510,8 +510,10 @@
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;