diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2011-11-01 09:12:33 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@serles.lst.de> | 2011-11-02 07:53:42 -0400 |
commit | 32096ea1aac14e6f29d4744924092eca52b937b0 (patch) | |
tree | 2ecb3df822078e38d85c1e5a1b82aaf3a70c879d /fs/libfs.c | |
parent | 994c0e992522c123298b4a91b72f5e67ba2d1123 (diff) |
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>
Diffstat (limited to 'fs/libfs.c')
-rw-r--r-- | fs/libfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/libfs.c b/fs/libfs.c index c18e9a1235b6..a2c0029cd95f 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -510,8 +510,10 @@ int simple_fill_super(struct super_block *s, unsigned long magic, | |||
510 | if (!dentry) | 510 | if (!dentry) |
511 | goto out; | 511 | goto out; |
512 | inode = new_inode(s); | 512 | inode = new_inode(s); |
513 | if (!inode) | 513 | if (!inode) { |
514 | dput(dentry); | ||
514 | goto out; | 515 | goto out; |
516 | } | ||
515 | inode->i_mode = S_IFREG | files->mode; | 517 | inode->i_mode = S_IFREG | files->mode; |
516 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 518 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
517 | inode->i_fop = files->ops; | 519 | inode->i_fop = files->ops; |