提交 0b964446 编写于 作者: M Miklos Szeredi 提交者: Tyler Hicks

ecryptfs: fix uid translation for setxattr on security.capability

Prior to commit 7c03e2cd ("vfs: move cap_convert_nscap() call into
vfs_setxattr()") the translation of nscap->rootid did not take stacked
filesystems (overlayfs and ecryptfs) into account.

That patch fixed the overlay case, but made the ecryptfs case worse.

Restore old the behavior for ecryptfs that existed before the overlayfs
fix.  This does not fix ecryptfs's handling of complex user namespace
setups, but it does make sure existing setups don't regress.
Reported-by: NEric W. Biederman <ebiederm@xmission.com>
Cc: Tyler Hicks <code@tyhicks.com>
Fixes: 7c03e2cd ("vfs: move cap_convert_nscap() call into vfs_setxattr()")
Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: NTyler Hicks <code@tyhicks.com>
上级 83d09ad4
...@@ -1016,15 +1016,19 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, ...@@ -1016,15 +1016,19 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode,
{ {
int rc; int rc;
struct dentry *lower_dentry; struct dentry *lower_dentry;
struct inode *lower_inode;
lower_dentry = ecryptfs_dentry_to_lower(dentry); 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; rc = -EOPNOTSUPP;
goto out; 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) if (!rc && inode)
fsstack_copy_attr_all(inode, d_inode(lower_dentry)); fsstack_copy_attr_all(inode, lower_inode);
out: out:
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册