Skip to content

Commit 6b5732b

Browse files
Eric Sandeenbrauner
authored andcommitted
ext4: Convert to new uid/gid option parsing helpers
Convert to new uid/gid option parsing helpers Signed-off-by: Eric Sandeen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent ffe1b94 commit 6b5732b

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

fs/ext4/super.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,8 +1721,8 @@ static const struct fs_parameter_spec ext4_param_specs[] = {
17211721
fsparam_flag ("bsdgroups", Opt_grpid),
17221722
fsparam_flag ("nogrpid", Opt_nogrpid),
17231723
fsparam_flag ("sysvgroups", Opt_nogrpid),
1724-
fsparam_u32 ("resgid", Opt_resgid),
1725-
fsparam_u32 ("resuid", Opt_resuid),
1724+
fsparam_gid ("resgid", Opt_resgid),
1725+
fsparam_uid ("resuid", Opt_resuid),
17261726
fsparam_u32 ("sb", Opt_sb),
17271727
fsparam_enum ("errors", Opt_errors, ext4_param_errors),
17281728
fsparam_flag ("nouid32", Opt_nouid32),
@@ -2127,8 +2127,6 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
21272127
struct fs_parse_result result;
21282128
const struct mount_opts *m;
21292129
int is_remount;
2130-
kuid_t uid;
2131-
kgid_t gid;
21322130
int token;
21332131

21342132
token = fs_parse(fc, ext4_param_specs, param, &result);
@@ -2270,23 +2268,11 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
22702268
ctx->spec |= EXT4_SPEC_s_stripe;
22712269
return 0;
22722270
case Opt_resuid:
2273-
uid = make_kuid(current_user_ns(), result.uint_32);
2274-
if (!uid_valid(uid)) {
2275-
ext4_msg(NULL, KERN_ERR, "Invalid uid value %d",
2276-
result.uint_32);
2277-
return -EINVAL;
2278-
}
2279-
ctx->s_resuid = uid;
2271+
ctx->s_resuid = result.uid;
22802272
ctx->spec |= EXT4_SPEC_s_resuid;
22812273
return 0;
22822274
case Opt_resgid:
2283-
gid = make_kgid(current_user_ns(), result.uint_32);
2284-
if (!gid_valid(gid)) {
2285-
ext4_msg(NULL, KERN_ERR, "Invalid gid value %d",
2286-
result.uint_32);
2287-
return -EINVAL;
2288-
}
2289-
ctx->s_resgid = gid;
2275+
ctx->s_resgid = result.gid;
22902276
ctx->spec |= EXT4_SPEC_s_resgid;
22912277
return 0;
22922278
case Opt_journal_dev:

0 commit comments

Comments
 (0)