Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-09 02:58:33 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-02-09 02:58:33 -0800
commit95baae3390157f753fcf07603bd8247095ccab38 (patch)
tree495fd92ce1550ae18316dfa774896bf040caed04
parent4243eb72ae8bc57653c8c5b5ed217b9a309f77e6 (diff)
[PATCH] getxattr error checking fix
From: Nathan Scott <nathans@sgi.com>, Andreas Gruenbacher <agruen@suse.de> XFS regression tests tripped a couple of problems with the recent xattr fix. When a size of 0 is passed in, the getxattr and listxattr syscalls return the size that would be required for the value or list of names, without actually returning the value. The previous patch accidentally removed this test, and so querying the required size broke.
-rw-r--r--fs/xattr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 10adae3f722e..24bd5427d4f4 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -140,7 +140,7 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
goto out;
error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
if (error > 0) {
- if (copy_to_user(value, kvalue, error))
+ if (size && copy_to_user(value, kvalue, error))
error = -EFAULT;
} else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {
/* The file system tried to returned a value bigger
@@ -222,7 +222,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
goto out;
error = d->d_inode->i_op->listxattr(d, klist, size);
if (error > 0) {
- if (copy_to_user(list, klist, error))
+ if (size && copy_to_user(list, klist, error))
error = -EFAULT;
} else if (error == -ERANGE && size >= XATTR_LIST_MAX) {
/* The file system tried to returned a list bigger