aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inotify_user.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 23:23:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 23:23:44 -0400
commit4836e3007882984279ca63d3c42bf0b14616eb78 (patch)
tree28bf22726964e068b825491d71a141eefedbe5f8 /fs/inotify_user.c
parent5c7c204aeca51ccfad63caab4fcdc5d8026c0fd8 (diff)
parent4e1e018ecc6f7bfd10fc75b3ff9715cc8164e0a2 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (39 commits) [PATCH] fix RLIM_NOFILE handling [PATCH] get rid of corner case in dup3() entirely [PATCH] remove remaining namei_{32,64}.h crap [PATCH] get rid of indirect users of namei.h [PATCH] get rid of __user_path_lookup_open [PATCH] f_count may wrap around [PATCH] dup3 fix [PATCH] don't pass nameidata to __ncp_lookup_validate() [PATCH] don't pass nameidata to gfs2_lookupi() [PATCH] new (local) helper: user_path_parent() [PATCH] sanitize __user_walk_fd() et.al. [PATCH] preparation to __user_walk_fd cleanup [PATCH] kill nameidata passing to permission(), rename to inode_permission() [PATCH] take noexec checks to very few callers that care Re: [PATCH 3/6] vfs: open_exec cleanup [patch 4/4] vfs: immutable inode checking cleanup [patch 3/4] fat: dont call notify_change [patch 2/4] vfs: utimes cleanup [patch 1/4] vfs: utimes: move owner check into inode_change_ok() [PATCH] vfs: use kstrdup() and check failing allocation ...
Diffstat (limited to 'fs/inotify_user.c')
-rw-r--r--fs/inotify_user.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index fe79c25d95dc..60249429a253 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -354,20 +354,20 @@ static void inotify_dev_event_dequeue(struct inotify_device *dev)
354} 354}
355 355
356/* 356/*
357 * find_inode - resolve a user-given path to a specific inode and return a nd 357 * find_inode - resolve a user-given path to a specific inode
358 */ 358 */
359static int find_inode(const char __user *dirname, struct nameidata *nd, 359static int find_inode(const char __user *dirname, struct path *path,
360 unsigned flags) 360 unsigned flags)
361{ 361{
362 int error; 362 int error;
363 363
364 error = __user_walk(dirname, flags, nd); 364 error = user_path_at(AT_FDCWD, dirname, flags, path);
365 if (error) 365 if (error)
366 return error; 366 return error;
367 /* you can only watch an inode if you have read permissions on it */ 367 /* you can only watch an inode if you have read permissions on it */
368 error = vfs_permission(nd, MAY_READ); 368 error = inode_permission(path->dentry->d_inode, MAY_READ);
369 if (error) 369 if (error)
370 path_put(&nd->path); 370 path_put(path);
371 return error; 371 return error;
372} 372}
373 373
@@ -650,11 +650,11 @@ asmlinkage long sys_inotify_init(void)
650 return sys_inotify_init1(0); 650 return sys_inotify_init1(0);
651} 651}
652 652
653asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) 653asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask)
654{ 654{
655 struct inode *inode; 655 struct inode *inode;
656 struct inotify_device *dev; 656 struct inotify_device *dev;
657 struct nameidata nd; 657 struct path path;
658 struct file *filp; 658 struct file *filp;
659 int ret, fput_needed; 659 int ret, fput_needed;
660 unsigned flags = 0; 660 unsigned flags = 0;
@@ -674,12 +674,12 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
674 if (mask & IN_ONLYDIR) 674 if (mask & IN_ONLYDIR)
675 flags |= LOOKUP_DIRECTORY; 675 flags |= LOOKUP_DIRECTORY;
676 676
677 ret = find_inode(path, &nd, flags); 677 ret = find_inode(pathname, &path, flags);
678 if (unlikely(ret)) 678 if (unlikely(ret))
679 goto fput_and_out; 679 goto fput_and_out;
680 680
681 /* inode held in place by reference to nd; dev by fget on fd */ 681 /* inode held in place by reference to path; dev by fget on fd */
682 inode = nd.path.dentry->d_inode; 682 inode = path.dentry->d_inode;
683 dev = filp->private_data; 683 dev = filp->private_data;
684 684
685 mutex_lock(&dev->up_mutex); 685 mutex_lock(&dev->up_mutex);
@@ -688,7 +688,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
688 ret = create_watch(dev, inode, mask); 688 ret = create_watch(dev, inode, mask);
689 mutex_unlock(&dev->up_mutex); 689 mutex_unlock(&dev->up_mutex);
690 690
691 path_put(&nd.path); 691 path_put(&path);
692fput_and_out: 692fput_and_out:
693 fput_light(filp, fput_needed); 693 fput_light(filp, fput_needed);
694 return ret; 694 return ret;