Re: [BUG] With size > XATTR_SIZE_MAX, getxattr(2) always returns E2BIG

From: Nathan Scott
Date: Sun Feb 08 2004 - 20:29:50 EST


On Tue, Feb 03, 2004 at 01:52:19PM +0100, Andreas Gruenbacher wrote:
> Hello,
>
> here is a fix for the getxattr and listxattr syscall. Explanation in the
> patch. Could you please apply? Thanks.

Our regression tests tripped a couple of problems with this;
here's a patch on top of yours (which is now 2.6.3-rc1).

cheers.

--
Nathan


--- /usr/tmp/TmpDir.13927-0/fs/xattr.c_1.2 2004-02-09 11:42:31.000000000 +1100
+++ fs/xattr.c 2004-02-09 11:37:39.747592560 +1100
@@ -139,7 +139,7 @@
if (error)
goto out;
error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
- if (error > 0) {
+ if (size && error > 0) {
if (copy_to_user(value, kvalue, error))
error = -EFAULT;
} else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {
@@ -221,7 +221,7 @@
if (error)
goto out;
error = d->d_inode->i_op->listxattr(d, klist, size);
- if (error > 0) {
+ if (size && error > 0) {
if (copy_to_user(list, klist, error))
error = -EFAULT;
} else if (error == -ERANGE && size >= XATTR_LIST_MAX) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/