Skip to content

Commit 3229e3a

Browse files
Eric Sandeenbrauner
authored andcommitted
smb: client: 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 2ec0701 commit 3229e3a

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

fs/smb/client/fs_context.c

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,14 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
128128
fsparam_flag("compress", Opt_compress),
129129
fsparam_flag("witness", Opt_witness),
130130

131+
/* Mount options which take uid or gid */
132+
fsparam_uid("backupuid", Opt_backupuid),
133+
fsparam_gid("backupgid", Opt_backupgid),
134+
fsparam_uid("uid", Opt_uid),
135+
fsparam_uid("cruid", Opt_cruid),
136+
fsparam_gid("gid", Opt_gid),
137+
131138
/* Mount options which take numeric value */
132-
fsparam_u32("backupuid", Opt_backupuid),
133-
fsparam_u32("backupgid", Opt_backupgid),
134-
fsparam_u32("uid", Opt_uid),
135-
fsparam_u32("cruid", Opt_cruid),
136-
fsparam_u32("gid", Opt_gid),
137139
fsparam_u32("file_mode", Opt_file_mode),
138140
fsparam_u32("dirmode", Opt_dirmode),
139141
fsparam_u32("dir_mode", Opt_dirmode),
@@ -951,8 +953,6 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
951953
int i, opt;
952954
bool is_smb3 = !strcmp(fc->fs_type->name, "smb3");
953955
bool skip_parsing = false;
954-
kuid_t uid;
955-
kgid_t gid;
956956

957957
cifs_dbg(FYI, "CIFS: parsing cifs mount option '%s'\n", param->key);
958958

@@ -1083,38 +1083,23 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
10831083
}
10841084
break;
10851085
case Opt_uid:
1086-
uid = make_kuid(current_user_ns(), result.uint_32);
1087-
if (!uid_valid(uid))
1088-
goto cifs_parse_mount_err;
1089-
ctx->linux_uid = uid;
1086+
ctx->linux_uid = result.uid;
10901087
ctx->uid_specified = true;
10911088
break;
10921089
case Opt_cruid:
1093-
uid = make_kuid(current_user_ns(), result.uint_32);
1094-
if (!uid_valid(uid))
1095-
goto cifs_parse_mount_err;
1096-
ctx->cred_uid = uid;
1090+
ctx->cred_uid = result.uid;
10971091
ctx->cruid_specified = true;
10981092
break;
10991093
case Opt_backupuid:
1100-
uid = make_kuid(current_user_ns(), result.uint_32);
1101-
if (!uid_valid(uid))
1102-
goto cifs_parse_mount_err;
1103-
ctx->backupuid = uid;
1094+
ctx->backupuid = result.uid;
11041095
ctx->backupuid_specified = true;
11051096
break;
11061097
case Opt_backupgid:
1107-
gid = make_kgid(current_user_ns(), result.uint_32);
1108-
if (!gid_valid(gid))
1109-
goto cifs_parse_mount_err;
1110-
ctx->backupgid = gid;
1098+
ctx->backupgid = result.gid;
11111099
ctx->backupgid_specified = true;
11121100
break;
11131101
case Opt_gid:
1114-
gid = make_kgid(current_user_ns(), result.uint_32);
1115-
if (!gid_valid(gid))
1116-
goto cifs_parse_mount_err;
1117-
ctx->linux_gid = gid;
1102+
ctx->linux_gid = result.gid;
11181103
ctx->gid_specified = true;
11191104
break;
11201105
case Opt_port:

0 commit comments

Comments
 (0)