switch alloc_file() to passing struct path

... and have the caller grab both mnt and dentry; kill
leak in infiniband, while we are at it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro
2009-08-09 00:52:35 +04:00
parent a95161aaa8
commit 2c48b9c455
11 changed files with 78 additions and 63 deletions

View File

@@ -2200,7 +2200,7 @@ pfm_alloc_file(pfm_context_t *ctx)
{
struct file *file;
struct inode *inode;
struct dentry *dentry;
struct path path;
char name[32];
struct qstr this;
@@ -2225,18 +2225,19 @@ pfm_alloc_file(pfm_context_t *ctx)
/*
* allocate a new dcache entry
*/
dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
if (!dentry) {
path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
if (!path.dentry) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
path.mnt = mntget(pfmfs_mnt);
dentry->d_op = &pfmfs_dentry_operations;
d_add(dentry, inode);
path.dentry->d_op = &pfmfs_dentry_operations;
d_add(path.dentry, inode);
file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops);
file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
if (!file) {
dput(dentry);
path_put(&path);
return ERR_PTR(-ENFILE);
}