fix workstation_name for multiuser mounts
Subsystems (2)
Long time user, first time contributor.
Please let me know if I need to be doing something different.
Thanks,
-Ryan
PATCH 1/1 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.
--- fs/cifs/connect.c | 13 +++++++++++++ fs/cifs/sess.c | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-)
fs/cifs/connect.c +13 -0
@@ -1945,6 +1945,19 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses) } } + ctx->workstation_name =kstrdup (ses->workstation_name,GFP_KERNEL ); +if (!ctx->workstation_name) { +cifs_dbg (FYI ,"Unable to allocate memory for workstation_name\n" ); + rc = -ENOMEM ; +kfree (ctx->username); + ctx->username =NULL ; +kfree_sensitive (ctx->password); + ctx->password =NULL ; +kfree (ctx->domainname); + ctx->domainname =NULL ; + goto out_key_put; + } + out_key_put:up_read (&key->sem);key_put (key);
fs/cifs/sess.c +5 -1
@@ -675,7 +675,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; }
Signature · 1 line
2.33.1
Re: [PATCH] cifs: fix workstation_name for multiuser mounts
fs/cifs/connect.c
Quoted 14 lines · Ryan Bair
Set
workstation_namefrom themaster_tconfor multiuser mounts.Just in case, protect
size_of_ntlmssp_blobagainst a NULLworkstation_name.Signed-off-by Ryan Bair <[email protected]>--- fs/cifs/connect.c | 13 +++++++++++++ fs/cifs/sess.c | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-)fs/cifs/connect.c +0
-0
Steve, could you pick this up? Please also add the following tags:
Thanks.
Re: [PATCH] cifs: fix workstation_name for multiuser mounts
In reply to Ryan BairMissed this email thread during the holidays - will test it out later this week.
Quoted 55 lines · Ryan Bair
Set
workstation_namefrom themaster_tconfor multiuser mounts.Just in case, protect
size_of_ntlmssp_blobagainst a NULLworkstation_name.Signed-off-by Ryan Bair <[email protected]>--- fs/cifs/connect.c | 13 +++++++++++++ fs/cifs/sess.c | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-)fs/cifs/connect.c +13
-0@@ -1945,6 +1945,19 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses) } } + ctx->workstation_name =kstrdup (ses->workstation_name,GFP_KERNEL ); +if (!ctx->workstation_name) { +cifs_dbg (FYI ,"Unable to allocate memory for workstation_name\n" ); + rc = -ENOMEM ; +kfree (ctx->username); + ctx->username =NULL ; +kfree_sensitive (ctx->password); + ctx->password =NULL ; +kfree (ctx->domainname); + ctx->domainname =NULL ; + goto out_key_put; + } + out_key_put:up_read (&key->sem);key_put (key);fs/cifs/sess.c +5
-2@@ -675,7 +675,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; } --2.33.1
Signature · 3 lines
Thanks, Steve