Skip to content

Commit a29967b

Browse files
committed
Merge tag 'v6.14-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: "Six smb3 client fixes, all also for stable" * tag 'v6.14-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb: client: Fix match_session bug preventing session reuse cifs: Fix integer overflow while processing closetimeo mount option cifs: Fix integer overflow while processing actimeo mount option cifs: Fix integer overflow while processing acdirmax mount option cifs: Fix integer overflow while processing acregmax mount option smb: client: fix regression with guest option
2 parents 85ac31f + 605b249 commit a29967b

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

fs/smb/client/connect.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,9 +1825,8 @@ static int match_session(struct cifs_ses *ses,
18251825
struct smb3_fs_context *ctx,
18261826
bool match_super)
18271827
{
1828-
if (ctx->sectype != Unspecified &&
1829-
ctx->sectype != ses->sectype)
1830-
return 0;
1828+
struct TCP_Server_Info *server = ses->server;
1829+
enum securityEnum ctx_sec, ses_sec;
18311830

18321831
if (!match_super && ctx->dfs_root_ses != ses->dfs_root_ses)
18331832
return 0;
@@ -1839,11 +1838,20 @@ static int match_session(struct cifs_ses *ses,
18391838
if (ses->chan_max < ctx->max_channels)
18401839
return 0;
18411840

1842-
switch (ses->sectype) {
1841+
ctx_sec = server->ops->select_sectype(server, ctx->sectype);
1842+
ses_sec = server->ops->select_sectype(server, ses->sectype);
1843+
1844+
if (ctx_sec != ses_sec)
1845+
return 0;
1846+
1847+
switch (ctx_sec) {
1848+
case IAKerb:
18431849
case Kerberos:
18441850
if (!uid_eq(ctx->cred_uid, ses->cred_uid))
18451851
return 0;
18461852
break;
1853+
case NTLMv2:
1854+
case RawNTLMSSP:
18471855
default:
18481856
/* NULL username means anonymous session */
18491857
if (ses->user_name == NULL) {

fs/smb/client/fs_context.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
171171
fsparam_string("username", Opt_user),
172172
fsparam_string("pass", Opt_pass),
173173
fsparam_string("password", Opt_pass),
174+
fsparam_string("pass2", Opt_pass2),
174175
fsparam_string("password2", Opt_pass2),
175176
fsparam_string("ip", Opt_ip),
176177
fsparam_string("addr", Opt_ip),
@@ -1131,6 +1132,9 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
11311132
} else if (!strcmp("user", param->key) || !strcmp("username", param->key)) {
11321133
skip_parsing = true;
11331134
opt = Opt_user;
1135+
} else if (!strcmp("pass2", param->key) || !strcmp("password2", param->key)) {
1136+
skip_parsing = true;
1137+
opt = Opt_pass2;
11341138
}
11351139
}
11361140

@@ -1340,21 +1344,21 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13401344
}
13411345
break;
13421346
case Opt_acregmax:
1343-
ctx->acregmax = HZ * result.uint_32;
1344-
if (ctx->acregmax > CIFS_MAX_ACTIMEO) {
1347+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
13451348
cifs_errorf(fc, "acregmax too large\n");
13461349
goto cifs_parse_mount_err;
13471350
}
1351+
ctx->acregmax = HZ * result.uint_32;
13481352
break;
13491353
case Opt_acdirmax:
1350-
ctx->acdirmax = HZ * result.uint_32;
1351-
if (ctx->acdirmax > CIFS_MAX_ACTIMEO) {
1354+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
13521355
cifs_errorf(fc, "acdirmax too large\n");
13531356
goto cifs_parse_mount_err;
13541357
}
1358+
ctx->acdirmax = HZ * result.uint_32;
13551359
break;
13561360
case Opt_actimeo:
1357-
if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {
1361+
if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
13581362
cifs_errorf(fc, "timeout too large\n");
13591363
goto cifs_parse_mount_err;
13601364
}
@@ -1366,11 +1370,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
13661370
ctx->acdirmax = ctx->acregmax = HZ * result.uint_32;
13671371
break;
13681372
case Opt_closetimeo:
1369-
ctx->closetimeo = HZ * result.uint_32;
1370-
if (ctx->closetimeo > SMB3_MAX_DCLOSETIMEO) {
1373+
if (result.uint_32 > SMB3_MAX_DCLOSETIMEO / HZ) {
13711374
cifs_errorf(fc, "closetimeo too large\n");
13721375
goto cifs_parse_mount_err;
13731376
}
1377+
ctx->closetimeo = HZ * result.uint_32;
13741378
break;
13751379
case Opt_echo_interval:
13761380
ctx->echo_interval = result.uint_32;

0 commit comments

Comments
 (0)