diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-09-10 23:17:44 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-09-18 04:01:35 -0400 |
commit | 5f3a4a28ec140a90e6058d1d09f6b1f235d485e5 (patch) | |
tree | a8fc30f22d94033bd5bb4ccfe5218b01bfafcc50 /fs/gfs2/acl.c | |
parent | 2f6f0654ab61961fd0f7701fe3be89ea111f0cda (diff) |
userns: Pass a userns parameter into posix_acl_to_xattr and posix_acl_from_xattr
- Pass the user namespace the uid and gid values in the xattr are stored
in into posix_acl_from_xattr.
- Pass the user namespace kuid and kgid values should be converted into
when storing uid and gid values in an xattr in posix_acl_to_xattr.
- Modify all callers of posix_acl_from_xattr and posix_acl_to_xattr to
pass in &init_user_ns.
In the short term this change is not strictly needed but it makes the
code clearer. In the longer term this change is necessary to be able to
mount filesystems outside of the initial user namespace that natively
store posix acls in the linux xattr format.
Cc: Theodore Tso <tytso@mit.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/gfs2/acl.c')
-rw-r--r-- | fs/gfs2/acl.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index bd4a5892c93c..f850020ad906 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -63,7 +63,7 @@ struct posix_acl *gfs2_get_acl(struct inode *inode, int type) | |||
63 | if (len == 0) | 63 | if (len == 0) |
64 | return NULL; | 64 | return NULL; |
65 | 65 | ||
66 | acl = posix_acl_from_xattr(data, len); | 66 | acl = posix_acl_from_xattr(&init_user_ns, data, len); |
67 | kfree(data); | 67 | kfree(data); |
68 | return acl; | 68 | return acl; |
69 | } | 69 | } |
@@ -88,13 +88,13 @@ static int gfs2_acl_set(struct inode *inode, int type, struct posix_acl *acl) | |||
88 | const char *name = gfs2_acl_name(type); | 88 | const char *name = gfs2_acl_name(type); |
89 | 89 | ||
90 | BUG_ON(name == NULL); | 90 | BUG_ON(name == NULL); |
91 | len = posix_acl_to_xattr(acl, NULL, 0); | 91 | len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0); |
92 | if (len == 0) | 92 | if (len == 0) |
93 | return 0; | 93 | return 0; |
94 | data = kmalloc(len, GFP_NOFS); | 94 | data = kmalloc(len, GFP_NOFS); |
95 | if (data == NULL) | 95 | if (data == NULL) |
96 | return -ENOMEM; | 96 | return -ENOMEM; |
97 | error = posix_acl_to_xattr(acl, data, len); | 97 | error = posix_acl_to_xattr(&init_user_ns, acl, data, len); |
98 | if (error < 0) | 98 | if (error < 0) |
99 | goto out; | 99 | goto out; |
100 | error = __gfs2_xattr_set(inode, name, data, len, 0, GFS2_EATYPE_SYS); | 100 | error = __gfs2_xattr_set(inode, name, data, len, 0, GFS2_EATYPE_SYS); |
@@ -166,12 +166,12 @@ int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr) | |||
166 | if (error) | 166 | if (error) |
167 | return error; | 167 | return error; |
168 | 168 | ||
169 | len = posix_acl_to_xattr(acl, NULL, 0); | 169 | len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0); |
170 | data = kmalloc(len, GFP_NOFS); | 170 | data = kmalloc(len, GFP_NOFS); |
171 | error = -ENOMEM; | 171 | error = -ENOMEM; |
172 | if (data == NULL) | 172 | if (data == NULL) |
173 | goto out; | 173 | goto out; |
174 | posix_acl_to_xattr(acl, data, len); | 174 | posix_acl_to_xattr(&init_user_ns, acl, data, len); |
175 | error = gfs2_xattr_acl_chmod(ip, attr, data); | 175 | error = gfs2_xattr_acl_chmod(ip, attr, data); |
176 | kfree(data); | 176 | kfree(data); |
177 | set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl); | 177 | set_cached_acl(&ip->i_inode, ACL_TYPE_ACCESS, acl); |
@@ -212,7 +212,7 @@ static int gfs2_xattr_system_get(struct dentry *dentry, const char *name, | |||
212 | if (acl == NULL) | 212 | if (acl == NULL) |
213 | return -ENODATA; | 213 | return -ENODATA; |
214 | 214 | ||
215 | error = posix_acl_to_xattr(acl, buffer, size); | 215 | error = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); |
216 | posix_acl_release(acl); | 216 | posix_acl_release(acl); |
217 | 217 | ||
218 | return error; | 218 | return error; |
@@ -245,7 +245,7 @@ static int gfs2_xattr_system_set(struct dentry *dentry, const char *name, | |||
245 | if (!value) | 245 | if (!value) |
246 | goto set_acl; | 246 | goto set_acl; |
247 | 247 | ||
248 | acl = posix_acl_from_xattr(value, size); | 248 | acl = posix_acl_from_xattr(&init_user_ns, value, size); |
249 | if (!acl) { | 249 | if (!acl) { |
250 | /* | 250 | /* |
251 | * acl_set_file(3) may request that we set default ACLs with | 251 | * acl_set_file(3) may request that we set default ACLs with |