From: Andreas Gruenbacher <agruen@suse.de>
To: Nathan Scott <nathans@sgi.com>
Cc: Andrew Morton <akpm@osdl.org>,
lkml <linux-kernel@vger.kernel.org>,
"Theodore Ts'o" <tytso@thunk.org>
Subject: Re: [BUG] With size > XATTR_SIZE_MAX, getxattr(2) always returns E2BIG
Date: Mon, 09 Feb 2004 03:42:58 +0100 [thread overview]
Message-ID: <1076294577.2205.68.camel@nb.suse.de> (raw)
In-Reply-To: <20040209012657.GA1466@frodo>
On Mon, 2004-02-09 at 02:26, Nathan Scott wrote:
> 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).
Indeed, I got that case wrong. The patch looks correct. Thanks!
I would move the missing test right before the copy_to_user as below,
which is slightly better.
Index: linux-2.6.3-rc1.orig/fs/xattr.c
===================================================================
--- linux-2.6.3-rc1.orig.orig/fs/xattr.c
+++ linux-2.6.3-rc1.orig/fs/xattr.c
@@ -140,7 +140,7 @@ getxattr(struct dentry *d, char __user *
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
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
> cheers.
--
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX AG
prev parent reply other threads:[~2004-02-09 2:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-03 12:52 Andreas Gruenbacher
2004-02-09 1:26 ` Nathan Scott
2004-02-09 2:42 ` Andreas Gruenbacher [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1076294577.2205.68.camel@nb.suse.de \
--to=agruen@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathans@sgi.com \
--cc=tytso@thunk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®