* [PATCH] vfs: Pass setxattr(2) flags properly
@ 2011-04-20 18:30 Jan Kara
2011-04-20 23:59 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2011-04-20 18:30 UTC (permalink / raw)
To: LKML; +Cc: linux-fsdevel, Andrew Morton, Al Viro, Linus Torvalds, Jan Kara
For some reason generic_setxattr() did not pass flags (XATTR_CREATE,
XATTR_REPLACE) to the filesystem specific helper. This caused that
setxattr(2) syscall just ignored these flags.
Fix the bug by passing flags correctly.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/xattr.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Who's handling VFS changes when Al is away? Andrew?
diff --git a/fs/xattr.c b/fs/xattr.c
index a19acdb..f1ef949 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -666,7 +666,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
- return handler->set(dentry, name, value, size, 0, handler->flags);
+ return handler->set(dentry, name, value, size, flags, handler->flags);
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] vfs: Pass setxattr(2) flags properly
2011-04-20 18:30 [PATCH] vfs: Pass setxattr(2) flags properly Jan Kara
@ 2011-04-20 23:59 ` Linus Torvalds
2011-04-21 3:09 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2011-04-20 23:59 UTC (permalink / raw)
To: Jan Kara, Christoph Hellwig; +Cc: LKML, linux-fsdevel, Andrew Morton, Al Viro
Hmm. This patch looks very sane, but it's been that way - ignoring the
'flags' value - since 2009. Does anybody actually _use_ the flags
field?
Judging by commit 431547b3c453 (that introduced the thing), it looks
like a plain mistake, and the previous "flags" was replaced by a "0"
in the call when it added the "hander->flags" argument at the end. But
the fact that it's been two years, and nobody noticed, makes me go
"hmm.."
Christoph added to participants, since he's the cause of that change.
On Wed, Apr 20, 2011 at 11:30 AM, Jan Kara <jack@suse.cz> wrote:
> For some reason generic_setxattr() did not pass flags (XATTR_CREATE,
> XATTR_REPLACE) to the filesystem specific helper. This caused that
> setxattr(2) syscall just ignored these flags.
>
> Fix the bug by passing flags correctly.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/xattr.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> Who's handling VFS changes when Al is away? Andrew?
I guess it's mostly me for at least the path handling, but for
something like this I'd like Christoph to take a look too. Even if it
_looks_ like a really obvious fix.
>
> diff --git a/fs/xattr.c b/fs/xattr.c
> index a19acdb..f1ef949 100644
> --- a/fs/xattr.c
> +++ b/fs/xattr.c
> @@ -666,7 +666,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
> handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
> if (!handler)
> return -EOPNOTSUPP;
> - return handler->set(dentry, name, value, size, 0, handler->flags);
> + return handler->set(dentry, name, value, size, flags, handler->flags);
> }
>
> /*
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vfs: Pass setxattr(2) flags properly
2011-04-20 23:59 ` Linus Torvalds
@ 2011-04-21 3:09 ` Christoph Hellwig
2011-04-21 3:58 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2011-04-21 3:09 UTC (permalink / raw)
To: Linus Torvalds
Cc: Jan Kara, Christoph Hellwig, LKML, linux-fsdevel, Andrew Morton,
Al Viro
On Wed, Apr 20, 2011 at 04:59:06PM -0700, Linus Torvalds wrote:
> Hmm. This patch looks very sane, but it's been that way - ignoring the
> 'flags' value - since 2009. Does anybody actually _use_ the flags
> field?
>
> Judging by commit 431547b3c453 (that introduced the thing), it looks
> like a plain mistake, and the previous "flags" was replaced by a "0"
> in the call when it added the "hander->flags" argument at the end. But
> the fact that it's been two years, and nobody noticed, makes me go
> "hmm.."
It's not really used very much. The only use of XATTR_CREATE is to
prevent creating the attrs used for ACLs from the normal xattrs
interface instead of going through the ACL code, and XATTR_REPLACE
is only used to return -ENOATTR when it's set but the attribute
actually is empty.
The first one could probably be used (by root) to create invalid
attrs that confuse the ACL code, and the second may confuse application
using it, although I doubt there are many.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vfs: Pass setxattr(2) flags properly
2011-04-21 3:09 ` Christoph Hellwig
@ 2011-04-21 3:58 ` Linus Torvalds
2011-04-21 4:17 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2011-04-21 3:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jan Kara, LKML, linux-fsdevel, Andrew Morton, Al Viro
On Wed, Apr 20, 2011 at 8:09 PM, Christoph Hellwig <hch@lst.de> wrote:
>
> It's not really used very much. The only use of XATTR_CREATE is to
> prevent creating the attrs used for ACLs from the normal xattrs
> interface instead of going through the ACL code, and XATTR_REPLACE
> is only used to return -ENOATTR when it's set but the attribute
> actually is empty.
>
> The first one could probably be used (by root) to create invalid
> attrs that confuse the ACL code, and the second may confuse application
> using it, although I doubt there are many.
Ok.
So nobody much i going to care. But I presume that you ack the patch
itself as correct?
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vfs: Pass setxattr(2) flags properly
2011-04-21 3:58 ` Linus Torvalds
@ 2011-04-21 4:17 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2011-04-21 4:17 UTC (permalink / raw)
To: Linus Torvalds
Cc: Christoph Hellwig, Jan Kara, LKML, linux-fsdevel, Andrew Morton,
Al Viro
On Wed, Apr 20, 2011 at 08:58:35PM -0700, Linus Torvalds wrote:
> So nobody much i going to care. But I presume that you ack the patch
> itself as correct?
Yes, the patch looks correct.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-21 4:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20 18:30 [PATCH] vfs: Pass setxattr(2) flags properly Jan Kara
2011-04-20 23:59 ` Linus Torvalds
2011-04-21 3:09 ` Christoph Hellwig
2011-04-21 3:58 ` Linus Torvalds
2011-04-21 4:17 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).