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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user