summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-04-30 12:21:51 -0700
committerBrian Behlendorf <[email protected]>2016-04-30 12:21:51 -0700
commit874bd959f4f15b3d4b007160ee7ad3f4111dd341 (patch)
tree9011ab55504a33be9c6ffaefbea3acbfc2ef9c91 /include/linux
parent1ab3678b5d671b4561a2d63958d56b2f7ca1b69e (diff)
Fix user namespaces uid/gid mapping
As described in torvalds/linux@5f3a4a2 the &init_user_ns, and not the current user_ns, should be passed to posix_acl_from_xattr() and posix_acl_to_xattr(). Conveniently the init_user_ns is available through the init credential (kcred). Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Massimo Maggi <[email protected]> Closes #4177
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/xattr_compat.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/xattr_compat.h b/include/linux/xattr_compat.h
index eee6c1f94..5e19ea1e5 100644
--- a/include/linux/xattr_compat.h
+++ b/include/linux/xattr_compat.h
@@ -190,20 +190,20 @@ fn(struct inode *ip, const char *name, const void *buffer, \
/*
* Linux 3.7 API change. posix_acl_{from,to}_xattr gained the user_ns
- * parameter. For the HAVE_POSIX_ACL_FROM_XATTR_USERNS version the
- * userns _may_ not be correct because it's used outside the RCU.
+ * parameter. All callers are expected to pass the &init_user_ns which
+ * is available through the init credential (kcred).
*/
#ifdef HAVE_POSIX_ACL_FROM_XATTR_USERNS
static inline struct posix_acl *
zpl_acl_from_xattr(const void *value, int size)
{
- return (posix_acl_from_xattr(CRED()->user_ns, value, size));
+ return (posix_acl_from_xattr(kcred->user_ns, value, size));
}
static inline int
zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size)
{
- return (posix_acl_to_xattr(CRED()->user_ns, acl, value, size));
+ return (posix_acl_to_xattr(kcred->user_ns, acl, value, size));
}
#else