Skip to content

Commit

Permalink
Revert "xattr: allow setting user.* attributes on symlinks by owner"
Browse files Browse the repository at this point in the history
Fixes: #193

This reverts commit f50081c.
  • Loading branch information
damentz authored and heftig committed Dec 15, 2020
1 parent 00c5857 commit fa96c2b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,15 @@ xattr_permission(struct inode *inode, const char *name, int mask)
}

/*
* In the user.* namespace, only regular files, symbolic links, and
* directories can have extended attributes. For symbolic links and
* sticky directories, only the owner and privileged users can write
* attributes.
* 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.
*/
if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && !S_ISLNK(inode->i_mode))
if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
if (((S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX))
|| S_ISLNK(inode->i_mode)) && (mask & MAY_WRITE)
&& !inode_owner_or_capable(inode))
if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
(mask & MAY_WRITE) && !inode_owner_or_capable(inode))
return -EPERM;
}

Expand Down

0 comments on commit fa96c2b

Please sign in to comment.