Commit b8116216 authored by Nathan Scott's avatar Nathan Scott Committed by Linus Torvalds

[PATCH] xattr updates (minor, 2/4)

This incremental patch fixes copying out of an extended attribute
value or name list.  Previously we copied out the entire buffer
passed in from userspace, now we only copy out the size which the
underlying filesystem tells us to (ie. we will no longer include
potentialy-initialised data as well).

Nathan
parent c591d1c5
...@@ -163,7 +163,7 @@ getxattr(struct dentry *d, char *name, void *value, size_t size) ...@@ -163,7 +163,7 @@ getxattr(struct dentry *d, char *name, void *value, size_t size)
} }
if (kvalue && error > 0) if (kvalue && error > 0)
if (copy_to_user(value, kvalue, size)) if (copy_to_user(value, kvalue, error))
error = -EFAULT; error = -EFAULT;
xattr_free(kvalue, size); xattr_free(kvalue, size);
return error; return error;
...@@ -232,7 +232,7 @@ listxattr(struct dentry *d, char *list, size_t size) ...@@ -232,7 +232,7 @@ listxattr(struct dentry *d, char *list, size_t size)
} }
if (klist && error > 0) if (klist && error > 0)
if (copy_to_user(list, klist, size)) if (copy_to_user(list, klist, error))
error = -EFAULT; error = -EFAULT;
xattr_free(klist, size); xattr_free(klist, size);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment