summaryrefslogtreecommitdiff
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorRyan Bair <ryandbair@gmail.com>2021-12-22 11:04:05 -0500
committerSteve French <stfrench@microsoft.com>2022-02-03 00:16:37 -0600
commitd3b331fb51f326d5b5326010bf2b5841bb86cdc6 (patch)
treebbbbfff67f0f4f0b29de3ca02cff16f72f34b722 /fs/cifs/sess.c
parent40c845c176953311c8fc232e977516f7733c64cd (diff)
cifs: fix workstation_name for multiuser mounts
Set workstation_name from the master_tcon for multiuser mounts. Just in case, protect size_of_ntlmssp_blob against a NULL workstation_name. Fixes: 49bd49f983b5 ("cifs: send workstation name during ntlmssp session setup") Cc: stable@vger.kernel.org # 5.16 Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Ryan Bair <ryandbair@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index dc3b16d1be09..5723d50340e5 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -713,7 +713,11 @@ static int size_of_ntlmssp_blob(struct cifs_ses *ses, int base_size)
else
sz += sizeof(__le16);
- sz += sizeof(__le16) * strnlen(ses->workstation_name, CIFS_MAX_WORKSTATION_LEN);
+ if (ses->workstation_name)
+ sz += sizeof(__le16) * strnlen(ses->workstation_name,
+ CIFS_MAX_WORKSTATION_LEN);
+ else
+ sz += sizeof(__le16);
return sz;
}