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 /fs/notify | |
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 'fs/notify')
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 9e4f90042eaf..8271cf05c957 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -646,6 +646,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
646 | struct fsnotify_group *group; | 646 | struct fsnotify_group *group; |
647 | struct user_struct *user; | 647 | struct user_struct *user; |
648 | struct file *filp; | 648 | struct file *filp; |
649 | struct path path; | ||
649 | int fd, ret; | 650 | int fd, ret; |
650 | 651 | ||
651 | /* Check the IN_* constants for consistency. */ | 652 | /* Check the IN_* constants for consistency. */ |
@@ -675,8 +676,10 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
675 | 676 | ||
676 | atomic_inc(&user->inotify_devs); | 677 | atomic_inc(&user->inotify_devs); |
677 | 678 | ||
678 | filp = alloc_file(inotify_mnt, dget(inotify_mnt->mnt_root), | 679 | path.mnt = inotify_mnt; |
679 | FMODE_READ, &inotify_fops); | 680 | path.dentry = inotify_mnt->mnt_root; |
681 | path_get(&path); | ||
682 | filp = alloc_file(&path, FMODE_READ, &inotify_fops); | ||
680 | if (!filp) | 683 | if (!filp) |
681 | goto Enfile; | 684 | goto Enfile; |
682 | 685 | ||
@@ -689,6 +692,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
689 | 692 | ||
690 | Enfile: | 693 | Enfile: |
691 | ret = -ENFILE; | 694 | ret = -ENFILE; |
695 | path_put(&path); | ||
692 | atomic_dec(&user->inotify_devs); | 696 | atomic_dec(&user->inotify_devs); |
693 | out_free_uid: | 697 | out_free_uid: |
694 | free_uid(user); | 698 | free_uid(user); |