Commit bec4c296 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ecryptfs-5.11-rc6-setxattr-fix' of...

Merge tag 'ecryptfs-5.11-rc6-setxattr-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs

Pull ecryptfs fix from Tyler Hicks:
 "Fix a regression that resulted in two rounds of UID translations when
  setting v3 namespaced file capabilities in some configurations"

* tag 'ecryptfs-5.11-rc6-setxattr-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
  ecryptfs: fix uid translation for setxattr on security.capability
parents 909b447d 0b964446
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1016,15 +1016,19 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode,
{
	int rc;
	struct dentry *lower_dentry;
	struct inode *lower_inode;

	lower_dentry = ecryptfs_dentry_to_lower(dentry);
	if (!(d_inode(lower_dentry)->i_opflags & IOP_XATTR)) {
	lower_inode = d_inode(lower_dentry);
	if (!(lower_inode->i_opflags & IOP_XATTR)) {
		rc = -EOPNOTSUPP;
		goto out;
	}
	rc = vfs_setxattr(lower_dentry, name, value, size, flags);
	inode_lock(lower_inode);
	rc = __vfs_setxattr_locked(lower_dentry, name, value, size, flags, NULL);
	inode_unlock(lower_inode);
	if (!rc && inode)
		fsstack_copy_attr_all(inode, d_inode(lower_dentry));
		fsstack_copy_attr_all(inode, lower_inode);
out:
	return rc;
}