Skip to content

Commit 3353ab2

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: not allow guest user on multichannel
This patch return STATUS_NOT_SUPPORTED if binding session is guest. Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20480 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 7b43233 commit 3353ab2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ static int ntlm_authenticate(struct ksmbd_work *work)
14311431
* Reuse session if anonymous try to connect
14321432
* on reauthetication.
14331433
*/
1434-
if (ksmbd_anonymous_user(user)) {
1434+
if (conn->binding == false && ksmbd_anonymous_user(user)) {
14351435
ksmbd_free_user(user);
14361436
return 0;
14371437
}
@@ -1445,7 +1445,7 @@ static int ntlm_authenticate(struct ksmbd_work *work)
14451445
sess->user = user;
14461446
}
14471447

1448-
if (user_guest(sess->user)) {
1448+
if (conn->binding == false && user_guest(sess->user)) {
14491449
rsp->SessionFlags = SMB2_SESSION_FLAG_IS_GUEST_LE;
14501450
} else {
14511451
struct authenticate_message *authblob;
@@ -1687,6 +1687,11 @@ int smb2_sess_setup(struct ksmbd_work *work)
16871687
goto out_err;
16881688
}
16891689

1690+
if (user_guest(sess->user)) {
1691+
rc = -EOPNOTSUPP;
1692+
goto out_err;
1693+
}
1694+
16901695
conn->binding = true;
16911696
} else if ((conn->dialect < SMB30_PROT_ID ||
16921697
server_conf.flags & KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL) &&
@@ -1811,6 +1816,8 @@ int smb2_sess_setup(struct ksmbd_work *work)
18111816
rsp->hdr.Status = STATUS_NETWORK_SESSION_EXPIRED;
18121817
else if (rc == -ENOMEM)
18131818
rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
1819+
else if (rc == -EOPNOTSUPP)
1820+
rsp->hdr.Status = STATUS_NOT_SUPPORTED;
18141821
else if (rc)
18151822
rsp->hdr.Status = STATUS_LOGON_FAILURE;
18161823

0 commit comments

Comments
 (0)