aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/hypfs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-07 06:47:41 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-21 06:13:26 -0400
commit6a62a21625816e48c8448d3a67f15e7fef2ca859 (patch)
treea1a6c29afd9b804d04d04517c19fe7ba296e2ed8 /arch/s390/hypfs
parent4a2ebb93bf0ae67b4b49f1974a525523eb923da0 (diff)
userns: Convert s390 hypfs to use kuid and kgid where appropriate
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'arch/s390/hypfs')
-rw-r--r--arch/s390/hypfs/inode.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 6767b437a103..124ec1a55cc9 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -31,8 +31,8 @@ static struct dentry *hypfs_create_update_file(struct super_block *sb,
31 struct dentry *dir); 31 struct dentry *dir);
32 32
33struct hypfs_sb_info { 33struct hypfs_sb_info {
34 uid_t uid; /* uid used for files and dirs */ 34 kuid_t uid; /* uid used for files and dirs */
35 gid_t gid; /* gid used for files and dirs */ 35 kgid_t gid; /* gid used for files and dirs */
36 struct dentry *update_file; /* file to trigger update */ 36 struct dentry *update_file; /* file to trigger update */
37 time_t last_update; /* last update time in secs since 1970 */ 37 time_t last_update; /* last update time in secs since 1970 */
38 struct mutex lock; /* lock to protect update process */ 38 struct mutex lock; /* lock to protect update process */
@@ -229,6 +229,8 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
229{ 229{
230 char *str; 230 char *str;
231 substring_t args[MAX_OPT_ARGS]; 231 substring_t args[MAX_OPT_ARGS];
232 kuid_t uid;
233 kgid_t gid;
232 234
233 if (!options) 235 if (!options)
234 return 0; 236 return 0;
@@ -243,12 +245,18 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
243 case opt_uid: 245 case opt_uid:
244 if (match_int(&args[0], &option)) 246 if (match_int(&args[0], &option))
245 return -EINVAL; 247 return -EINVAL;
246 hypfs_info->uid = option; 248 uid = make_kuid(current_user_ns(), option);
249 if (!uid_valid(uid))
250 return -EINVAL;
251 hypfs_info->uid = uid;
247 break; 252 break;
248 case opt_gid: 253 case opt_gid:
249 if (match_int(&args[0], &option)) 254 if (match_int(&args[0], &option))
250 return -EINVAL; 255 return -EINVAL;
251 hypfs_info->gid = option; 256 gid = make_kgid(current_user_ns(), option);
257 if (!gid_valid(gid))
258 return -EINVAL;
259 hypfs_info->gid = gid;
252 break; 260 break;
253 case opt_err: 261 case opt_err:
254 default: 262 default:
@@ -263,8 +271,8 @@ static int hypfs_show_options(struct seq_file *s, struct dentry *root)
263{ 271{
264 struct hypfs_sb_info *hypfs_info = root->d_sb->s_fs_info; 272 struct hypfs_sb_info *hypfs_info = root->d_sb->s_fs_info;
265 273
266 seq_printf(s, ",uid=%u", hypfs_info->uid); 274 seq_printf(s, ",uid=%u", from_kuid_munged(&init_user_ns, hypfs_info->uid));
267 seq_printf(s, ",gid=%u", hypfs_info->gid); 275 seq_printf(s, ",gid=%u", from_kgid_munged(&init_user_ns, hypfs_info->gid));
268 return 0; 276 return 0;
269} 277}
270 278