From 32096ea1aac14e6f29d4744924092eca52b937b0 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Tue, 1 Nov 2011 16:12:33 +0300 Subject: [PATCH] vfs: fix dentry leak in simple_fill_super() put dentry if inode allocation failed, d_genocide() cannot release it Signed-off-by: Konstantin Khlebnikov Signed-off-by: Christoph Hellwig --- fs/libfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 @@ 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; -- 2.7.4