linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: allow user.* xattrs on symlinks
@ 2011-08-16 19:13 Josef Bacik
  0 siblings, 0 replies; only message in thread
From: Josef Bacik @ 2011-08-16 19:13 UTC (permalink / raw)
  To: linux-fsdevel, viro

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-16 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16 19:13 [PATCH] fs: allow user.* xattrs on symlinks Josef Bacik

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).