summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-12-13 10:15:39 -0800
committerSteve French <sfrench@us.ibm.com>2005-12-13 10:15:39 -0800
commitda8543ef125afc7bba4da526b61a1ae07dc25109 (patch)
tree6aec5867f8e054c22c6208032280ed1434c14a58 /fs
parentec637e3ffb6b978143652477c7c5f96c9519b691 (diff)
parent90ac8f7741be4ff66de1f52904f4f67f272f74ce (diff)
downloadop-kernel-dev-da8543ef125afc7bba4da526b61a1ae07dc25109.zip
op-kernel-dev-da8543ef125afc7bba4da526b61a1ae07dc25109.tar.gz
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/inotify.c13
-rw-r--r--fs/xattr.c2
2 files changed, 11 insertions, 4 deletions
diff --git a/fs/inotify.c b/fs/inotify.c
index bf7ce1d..2fecb7a 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -364,11 +364,12 @@ static int inotify_dev_get_wd(struct inotify_device *dev,
/*
* find_inode - resolve a user-given path to a specific inode and return a nd
*/
-static int find_inode(const char __user *dirname, struct nameidata *nd)
+static int find_inode(const char __user *dirname, struct nameidata *nd,
+ unsigned flags)
{
int error;
- error = __user_walk(dirname, LOOKUP_FOLLOW, nd);
+ error = __user_walk(dirname, flags, nd);
if (error)
return error;
/* you can only watch an inode if you have read permissions on it */
@@ -933,6 +934,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
struct file *filp;
int ret, fput_needed;
int mask_add = 0;
+ unsigned flags = 0;
filp = fget_light(fd, &fput_needed);
if (unlikely(!filp))
@@ -944,7 +946,12 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
goto fput_and_out;
}
- ret = find_inode(path, &nd);
+ if (!(mask & IN_DONT_FOLLOW))
+ flags |= LOOKUP_FOLLOW;
+ if (mask & IN_ONLYDIR)
+ flags |= LOOKUP_DIRECTORY;
+
+ ret = find_inode(path, &nd, flags);
if (unlikely(ret))
goto fput_and_out;
diff --git a/fs/xattr.c b/fs/xattr.c
index a9db225..bcc2156 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -245,7 +245,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
error = d->d_inode->i_op->listxattr(d, klist, size);
} else {
error = security_inode_listsecurity(d->d_inode, klist, size);
- if (size && error >= size)
+ if (size && error > size)
error = -ERANGE;
}
if (error > 0) {
OpenPOWER on IntegriCloud