Don't ignore errors on encrypting password in SMBTcon
authorSteve French <smfrench@gmail.com>
Fri, 27 Mar 2015 00:23:20 +0000 (19:23 -0500)
committerSteve French <smfrench@gmail.com>
Wed, 1 Apr 2015 05:01:46 +0000 (00:01 -0500)
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: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Jeff Layton <jlayton@poochiereds.net>
fs/cifs/connect.c

index 4cb8450e081b98f6345f01d6c0958813773a4b75..cdb1aaf295b1226e37eebaffbe6e6223cbd97ce6 100644 (file)
@@ -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) {