fs: allow user.* xattrs on symlinks
PATCH 1/1 fs: allow user.* xattrs on symlinks
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 <[email protected]>
--- fs/xattr.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
fs/xattr.c +5 -4
@@ -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))
Signature · 1 line
1.7.5.2