diff options
Diffstat (limited to 'fs/adfs/super.c')
-rw-r--r-- | fs/adfs/super.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index bdaec92353c2..22a0d7ed5fa1 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/statfs.h> | 17 | #include <linux/statfs.h> |
18 | #include <linux/user_namespace.h> | ||
18 | #include "adfs.h" | 19 | #include "adfs.h" |
19 | #include "dir_f.h" | 20 | #include "dir_f.h" |
20 | #include "dir_fplus.h" | 21 | #include "dir_fplus.h" |
@@ -130,10 +131,10 @@ static int adfs_show_options(struct seq_file *seq, struct dentry *root) | |||
130 | { | 131 | { |
131 | struct adfs_sb_info *asb = ADFS_SB(root->d_sb); | 132 | struct adfs_sb_info *asb = ADFS_SB(root->d_sb); |
132 | 133 | ||
133 | if (asb->s_uid != 0) | 134 | if (!uid_eq(asb->s_uid, GLOBAL_ROOT_UID)) |
134 | seq_printf(seq, ",uid=%u", asb->s_uid); | 135 | seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, asb->s_uid)); |
135 | if (asb->s_gid != 0) | 136 | if (!gid_eq(asb->s_gid, GLOBAL_ROOT_GID)) |
136 | seq_printf(seq, ",gid=%u", asb->s_gid); | 137 | seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, asb->s_gid)); |
137 | if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK) | 138 | if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK) |
138 | seq_printf(seq, ",ownmask=%o", asb->s_owner_mask); | 139 | seq_printf(seq, ",ownmask=%o", asb->s_owner_mask); |
139 | if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK) | 140 | if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK) |
@@ -175,12 +176,16 @@ static int parse_options(struct super_block *sb, char *options) | |||
175 | case Opt_uid: | 176 | case Opt_uid: |
176 | if (match_int(args, &option)) | 177 | if (match_int(args, &option)) |
177 | return -EINVAL; | 178 | return -EINVAL; |
178 | asb->s_uid = option; | 179 | asb->s_uid = make_kuid(current_user_ns(), option); |
180 | if (!uid_valid(asb->s_uid)) | ||
181 | return -EINVAL; | ||
179 | break; | 182 | break; |
180 | case Opt_gid: | 183 | case Opt_gid: |
181 | if (match_int(args, &option)) | 184 | if (match_int(args, &option)) |
182 | return -EINVAL; | 185 | return -EINVAL; |
183 | asb->s_gid = option; | 186 | asb->s_gid = make_kgid(current_user_ns(), option); |
187 | if (!gid_valid(asb->s_gid)) | ||
188 | return -EINVAL; | ||
184 | break; | 189 | break; |
185 | case Opt_ownmask: | 190 | case Opt_ownmask: |
186 | if (match_octal(args, &option)) | 191 | if (match_octal(args, &option)) |
@@ -369,8 +374,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
369 | sb->s_fs_info = asb; | 374 | sb->s_fs_info = asb; |
370 | 375 | ||
371 | /* set default options */ | 376 | /* set default options */ |
372 | asb->s_uid = 0; | 377 | asb->s_uid = GLOBAL_ROOT_UID; |
373 | asb->s_gid = 0; | 378 | asb->s_gid = GLOBAL_ROOT_GID; |
374 | asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK; | 379 | asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK; |
375 | asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK; | 380 | asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK; |
376 | asb->s_ftsuffix = 0; | 381 | asb->s_ftsuffix = 0; |