aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xattr_acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xattr_acl.c')
-rw-r--r--fs/xattr_acl.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/xattr_acl.c b/fs/xattr_acl.c
index bf472ca1b348..11efd830b5f5 100644
--- a/fs/xattr_acl.c
+++ b/fs/xattr_acl.c
@@ -73,7 +73,8 @@ void posix_acl_fix_xattr_to_user(void *value, size_t size)
73 * Convert from extended attribute to in-memory representation. 73 * Convert from extended attribute to in-memory representation.
74 */ 74 */
75struct posix_acl * 75struct posix_acl *
76posix_acl_from_xattr(const void *value, size_t size) 76posix_acl_from_xattr(struct user_namespace *user_ns,
77 const void *value, size_t size)
77{ 78{
78 posix_acl_xattr_header *header = (posix_acl_xattr_header *)value; 79 posix_acl_xattr_header *header = (posix_acl_xattr_header *)value;
79 posix_acl_xattr_entry *entry = (posix_acl_xattr_entry *)(header+1), *end; 80 posix_acl_xattr_entry *entry = (posix_acl_xattr_entry *)(header+1), *end;
@@ -112,14 +113,14 @@ posix_acl_from_xattr(const void *value, size_t size)
112 113
113 case ACL_USER: 114 case ACL_USER:
114 acl_e->e_uid = 115 acl_e->e_uid =
115 make_kuid(&init_user_ns, 116 make_kuid(user_ns,
116 le32_to_cpu(entry->e_id)); 117 le32_to_cpu(entry->e_id));
117 if (!uid_valid(acl_e->e_uid)) 118 if (!uid_valid(acl_e->e_uid))
118 goto fail; 119 goto fail;
119 break; 120 break;
120 case ACL_GROUP: 121 case ACL_GROUP:
121 acl_e->e_gid = 122 acl_e->e_gid =
122 make_kgid(&init_user_ns, 123 make_kgid(user_ns,
123 le32_to_cpu(entry->e_id)); 124 le32_to_cpu(entry->e_id));
124 if (!gid_valid(acl_e->e_gid)) 125 if (!gid_valid(acl_e->e_gid))
125 goto fail; 126 goto fail;
@@ -141,7 +142,8 @@ EXPORT_SYMBOL (posix_acl_from_xattr);
141 * Convert from in-memory to extended attribute representation. 142 * Convert from in-memory to extended attribute representation.
142 */ 143 */
143int 144int
144posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size) 145posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
146 void *buffer, size_t size)
145{ 147{
146 posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer; 148 posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer;
147 posix_acl_xattr_entry *ext_entry = ext_acl->a_entries; 149 posix_acl_xattr_entry *ext_entry = ext_acl->a_entries;
@@ -162,11 +164,11 @@ posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size)
162 switch(acl_e->e_tag) { 164 switch(acl_e->e_tag) {
163 case ACL_USER: 165 case ACL_USER:
164 ext_entry->e_id = 166 ext_entry->e_id =
165 cpu_to_le32(from_kuid(&init_user_ns, acl_e->e_uid)); 167 cpu_to_le32(from_kuid(user_ns, acl_e->e_uid));
166 break; 168 break;
167 case ACL_GROUP: 169 case ACL_GROUP:
168 ext_entry->e_id = 170 ext_entry->e_id =
169 cpu_to_le32(from_kgid(&init_user_ns, acl_e->e_gid)); 171 cpu_to_le32(from_kgid(user_ns, acl_e->e_gid));
170 break; 172 break;
171 default: 173 default:
172 ext_entry->e_id = cpu_to_le32(ACL_UNDEFINED_ID); 174 ext_entry->e_id = cpu_to_le32(ACL_UNDEFINED_ID);