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 /drivers/infiniband | |
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 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index aec0fbdfe7f0..5f284ffd430e 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -492,6 +492,7 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, | |||
492 | int is_async, int *fd) | 492 | int is_async, int *fd) |
493 | { | 493 | { |
494 | struct ib_uverbs_event_file *ev_file; | 494 | struct ib_uverbs_event_file *ev_file; |
495 | struct path path; | ||
495 | struct file *filp; | 496 | struct file *filp; |
496 | int ret; | 497 | int ret; |
497 | 498 | ||
@@ -519,8 +520,10 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, | |||
519 | * system call on a uverbs file, which will already have a | 520 | * system call on a uverbs file, which will already have a |
520 | * module reference. | 521 | * module reference. |
521 | */ | 522 | */ |
522 | filp = alloc_file(uverbs_event_mnt, dget(uverbs_event_mnt->mnt_root), | 523 | path.mnt = uverbs_event_mnt; |
523 | FMODE_READ, fops_get(&uverbs_event_fops)); | 524 | path.dentry = uverbs_event_mnt->mnt_root; |
525 | path_get(&path); | ||
526 | filp = alloc_file(&path, FMODE_READ, fops_get(&uverbs_event_fops)); | ||
524 | if (!filp) { | 527 | if (!filp) { |
525 | ret = -ENFILE; | 528 | ret = -ENFILE; |
526 | goto err_fd; | 529 | goto err_fd; |
@@ -531,6 +534,8 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, | |||
531 | return filp; | 534 | return filp; |
532 | 535 | ||
533 | err_fd: | 536 | err_fd: |
537 | fops_put(&uverbs_event_fops); | ||
538 | path_put(&path); | ||
534 | put_unused_fd(*fd); | 539 | put_unused_fd(*fd); |
535 | 540 | ||
536 | err: | 541 | err: |