summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRobert Love <rml@novell.com>2005-07-25 15:12:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-26 13:37:22 -0700
commit5eb22cbcdb849886c2584389faff5afb56c23876 (patch)
tree4a0147ea3f2021091c0ce686dc10225ef0ac7d83 /fs
parent783bc29bbc5d6625a4669d3eb1d989a8fb275d43 (diff)
downloadop-kernel-dev-5eb22cbcdb849886c2584389faff5afb56c23876.zip
op-kernel-dev-5eb22cbcdb849886c2584389faff5afb56c23876.tar.gz
[PATCH] inotify: exit path cleanups
Handle error out paths better. Signed-off-by: Robert Love <rml@novell.com> Signed-off-by: John McCutchan <ttb@tentacle.dhs.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/inotify.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/inotify.c b/fs/inotify.c
index b55d6e4..d41c53c 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -865,23 +865,21 @@ asmlinkage long sys_inotify_init(void)
filp = get_empty_filp();
if (!filp) {
- put_unused_fd(fd);
ret = -ENFILE;
- goto out;
+ goto out_put_fd;
}
user = get_uid(current->user);
-
if (unlikely(atomic_read(&user->inotify_devs) >=
inotify_max_user_instances)) {
ret = -EMFILE;
- goto out_err;
+ goto out_free_uid;
}
dev = kmalloc(sizeof(struct inotify_device), GFP_KERNEL);
if (unlikely(!dev)) {
ret = -ENOMEM;
- goto out_err;
+ goto out_free_uid;
}
filp->f_op = &inotify_fops;
@@ -908,11 +906,11 @@ asmlinkage long sys_inotify_init(void)
fd_install(fd, filp);
return fd;
-out_err:
- put_unused_fd (fd);
- put_filp (filp);
+out_free_uid:
free_uid(user);
-out:
+ put_filp(filp);
+out_put_fd:
+ put_unused_fd(fd);
return ret;
}
@@ -975,9 +973,9 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
list_add(&watch->i_list, &inode->inotify_watches);
ret = watch->wd;
out:
- path_release (&nd);
up(&dev->sem);
up(&inode->inotify_sem);
+ path_release(&nd);
fput_and_out:
fput_light(filp, fput_needed);
return ret;
OpenPOWER on IntegriCloud