diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-08-08 16:52:35 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:42 -0500 |
commit | 2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3 (patch) | |
tree | cecbf786ae0650368a8136bdd90910e05d9b95c3 /arch | |
parent | a95161aaa801c18c52b2e7cf3d6b4b141c00a20a (diff) |
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 599b233bef75..5246285a95fb 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2200,7 +2200,7 @@ pfm_alloc_file(pfm_context_t *ctx) | |||
2200 | { | 2200 | { |
2201 | struct file *file; | 2201 | struct file *file; |
2202 | struct inode *inode; | 2202 | struct inode *inode; |
2203 | struct dentry *dentry; | 2203 | struct path path; |
2204 | char name[32]; | 2204 | char name[32]; |
2205 | struct qstr this; | 2205 | struct qstr this; |
2206 | 2206 | ||
@@ -2225,18 +2225,19 @@ pfm_alloc_file(pfm_context_t *ctx) | |||
2225 | /* | 2225 | /* |
2226 | * allocate a new dcache entry | 2226 | * allocate a new dcache entry |
2227 | */ | 2227 | */ |
2228 | dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); | 2228 | path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); |
2229 | if (!dentry) { | 2229 | if (!path.dentry) { |
2230 | iput(inode); | 2230 | iput(inode); |
2231 | return ERR_PTR(-ENOMEM); | 2231 | return ERR_PTR(-ENOMEM); |
2232 | } | 2232 | } |
2233 | path.mnt = mntget(pfmfs_mnt); | ||
2233 | 2234 | ||
2234 | dentry->d_op = &pfmfs_dentry_operations; | 2235 | path.dentry->d_op = &pfmfs_dentry_operations; |
2235 | d_add(dentry, inode); | 2236 | d_add(path.dentry, inode); |
2236 | 2237 | ||
2237 | file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops); | 2238 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); |
2238 | if (!file) { | 2239 | if (!file) { |
2239 | dput(dentry); | 2240 | path_put(&path); |
2240 | return ERR_PTR(-ENFILE); | 2241 | return ERR_PTR(-ENFILE); |
2241 | } | 2242 | } |
2242 | 2243 | ||