From: Josef Bacik <josef@redhat.com>
To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: [PATCH] fs: allow user.* xattrs on symlinks
Date: Tue, 16 Aug 2011 15:13:19 -0400 [thread overview]
Message-ID: <1313521999-19760-1-git-send-email-josef@redhat.com> (raw)
I ran into this when I was trying to track down a lsetxattr bug on btrfs.
Apparently we're not allowed to set user.* xattrs on symlinks, but theres no
really clear reason why, and I should be able to use user.* for testing rather
than having to use trusted.*. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
fs/xattr.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/xattr.c b/fs/xattr.c
index f060663..22f231f 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -55,12 +55,13 @@ xattr_permission(struct inode *inode, const char *name, int mask)
}
/*
- * In the user.* namespace, only regular files and directories can have
- * extended attributes. For sticky directories, only the owner and
- * privileged users can write attributes.
+ * In the user.* namespace, only regular files, directories links
+ * can have extended attributes. For sticky directories, only the owner
+ * and privileged users can write attributes.
*/
if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
- if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
+ if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) &&
+ !S_ISLNK(inode->i_mode))
return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
(mask & MAY_WRITE) && !inode_owner_or_capable(inode))
--
1.7.5.2
reply other threads:[~2011-08-16 19:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1313521999-19760-1-git-send-email-josef@redhat.com \
--to=josef@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).