aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-10 15:20:35 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-09-21 07:18:54 -0400
commitc2ba138a27ddac4abbc931599dbce907c868910a (patch)
tree1bc49d763f119d352a5ddb5695d62639bb6181d0 /fs/udf/super.c
parent39241beb78f69925b0475ad78f06f0e0589fb71b (diff)
userns: Convert the udf filesystem to use kuid/kgid where appropriate
Cc: Jan Kara <jack@suse.cz> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index dcbf98722afc..38c705574b92 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -199,8 +199,8 @@ struct udf_options {
199 unsigned int rootdir; 199 unsigned int rootdir;
200 unsigned int flags; 200 unsigned int flags;
201 umode_t umask; 201 umode_t umask;
202 gid_t gid; 202 kgid_t gid;
203 uid_t uid; 203 kuid_t uid;
204 umode_t fmode; 204 umode_t fmode;
205 umode_t dmode; 205 umode_t dmode;
206 struct nls_table *nls_map; 206 struct nls_table *nls_map;
@@ -335,9 +335,9 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
335 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE)) 335 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_IGNORE))
336 seq_puts(seq, ",gid=ignore"); 336 seq_puts(seq, ",gid=ignore");
337 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET)) 337 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET))
338 seq_printf(seq, ",uid=%u", sbi->s_uid); 338 seq_printf(seq, ",uid=%u", from_kuid(&init_user_ns, sbi->s_uid));
339 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) 339 if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET))
340 seq_printf(seq, ",gid=%u", sbi->s_gid); 340 seq_printf(seq, ",gid=%u", from_kgid(&init_user_ns, sbi->s_gid));
341 if (sbi->s_umask != 0) 341 if (sbi->s_umask != 0)
342 seq_printf(seq, ",umask=%ho", sbi->s_umask); 342 seq_printf(seq, ",umask=%ho", sbi->s_umask);
343 if (sbi->s_fmode != UDF_INVALID_MODE) 343 if (sbi->s_fmode != UDF_INVALID_MODE)
@@ -516,13 +516,17 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
516 case Opt_gid: 516 case Opt_gid:
517 if (match_int(args, &option)) 517 if (match_int(args, &option))
518 return 0; 518 return 0;
519 uopt->gid = option; 519 uopt->gid = make_kgid(current_user_ns(), option);
520 if (!gid_valid(uopt->gid))
521 return 0;
520 uopt->flags |= (1 << UDF_FLAG_GID_SET); 522 uopt->flags |= (1 << UDF_FLAG_GID_SET);
521 break; 523 break;
522 case Opt_uid: 524 case Opt_uid:
523 if (match_int(args, &option)) 525 if (match_int(args, &option))
524 return 0; 526 return 0;
525 uopt->uid = option; 527 uopt->uid = make_kuid(current_user_ns(), option);
528 if (!uid_valid(uopt->uid))
529 return 0;
526 uopt->flags |= (1 << UDF_FLAG_UID_SET); 530 uopt->flags |= (1 << UDF_FLAG_UID_SET);
527 break; 531 break;
528 case Opt_umask: 532 case Opt_umask:
@@ -1931,8 +1935,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1931 struct udf_sb_info *sbi; 1935 struct udf_sb_info *sbi;
1932 1936
1933 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); 1937 uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
1934 uopt.uid = -1; 1938 uopt.uid = INVALID_UID;
1935 uopt.gid = -1; 1939 uopt.gid = INVALID_GID;
1936 uopt.umask = 0; 1940 uopt.umask = 0;
1937 uopt.fmode = UDF_INVALID_MODE; 1941 uopt.fmode = UDF_INVALID_MODE;
1938 uopt.dmode = UDF_INVALID_MODE; 1942 uopt.dmode = UDF_INVALID_MODE;