diff mbox

[2/4,CIFS] Don't ignore errors on encrypting password in SMBTcon

Message ID 1427434082-4299-3-git-send-email-smfrench@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French March 27, 2015, 5:28 a.m. UTC
Although unlikely to fail (and tree connect does not commonly send
a password since SECMODE_USER is the default for most servers)
do not ignore errors on SMBNTEncrypt in SMB Tree Connect.

Reported by Coverity (CID 1226853)

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/connect.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Shirish Pargaonkar March 28, 2015, 2:26 p.m. UTC | #1
Looks correct, although we could just goto a label at the end of this
function which
does the same.

Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>


On Fri, Mar 27, 2015 at 12:28 AM, Steve French <smfrench@gmail.com> wrote:
> Although unlikely to fail (and tree connect does not commonly send
> a password since SECMODE_USER is the default for most servers)
> do not ignore errors on SMBNTEncrypt in SMB Tree Connect.
>
> Reported by Coverity (CID 1226853)
>
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/connect.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 4cb8450..cdb1aaf 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3696,6 +3696,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
>  #endif /* CIFS_WEAK_PW_HASH */
>                 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
>                                         bcc_ptr, nls_codepage);
> +               if (rc) {
> +                       cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
> +                                __func__, rc);
> +                       cifs_buf_release(smb_buffer);
> +                       return rc;
> +               }
>
>                 bcc_ptr += CIFS_AUTH_RESP_SIZE;
>                 if (ses->capabilities & CAP_UNICODE) {
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sachin Prabhu March 30, 2015, 9:44 a.m. UTC | #2
On Fri, 2015-03-27 at 00:28 -0500, Steve French wrote:
> Although unlikely to fail (and tree connect does not commonly send
> a password since SECMODE_USER is the default for most servers)
> do not ignore errors on SMBNTEncrypt in SMB Tree Connect.
> 
> Reported by Coverity (CID 1226853)
> 
> Signed-off-by: Steve French <smfrench@gmail.com>

ACKed-by: Sachin Prabhu <sprabhu@redhat.com>

> ---
>  fs/cifs/connect.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 4cb8450..cdb1aaf 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3696,6 +3696,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
>  #endif /* CIFS_WEAK_PW_HASH */
>  		rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
>  					bcc_ptr, nls_codepage);
> +		if (rc) {
> +			cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
> +				 __func__, rc);
> +			cifs_buf_release(smb_buffer);
> +			return rc;
> +		}
>  
>  		bcc_ptr += CIFS_AUTH_RESP_SIZE;
>  		if (ses->capabilities & CAP_UNICODE) {


--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Layton April 1, 2015, 12:37 a.m. UTC | #3
On Fri, 27 Mar 2015 00:28:00 -0500
Steve French <smfrench@gmail.com> wrote:

> Although unlikely to fail (and tree connect does not commonly send
> a password since SECMODE_USER is the default for most servers)
> do not ignore errors on SMBNTEncrypt in SMB Tree Connect.
> 
> Reported by Coverity (CID 1226853)
> 
> Signed-off-by: Steve French <smfrench@gmail.com>
> ---
>  fs/cifs/connect.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 4cb8450..cdb1aaf 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3696,6 +3696,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
>  #endif /* CIFS_WEAK_PW_HASH */
>  		rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
>  					bcc_ptr, nls_codepage);
> +		if (rc) {
> +			cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
> +				 __func__, rc);
> +			cifs_buf_release(smb_buffer);
> +			return rc;
> +		}
>  
>  		bcc_ptr += CIFS_AUTH_RESP_SIZE;
>  		if (ses->capabilities & CAP_UNICODE) {

Acked-by:
diff mbox

Patch

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4cb8450..cdb1aaf 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3696,6 +3696,12 @@  CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
 #endif /* CIFS_WEAK_PW_HASH */
 		rc = SMBNTencrypt(tcon->password, ses->server->cryptkey,
 					bcc_ptr, nls_codepage);
+		if (rc) {
+			cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
+				 __func__, rc);
+			cifs_buf_release(smb_buffer);
+			return rc;
+		}
 
 		bcc_ptr += CIFS_AUTH_RESP_SIZE;
 		if (ses->capabilities & CAP_UNICODE) {