cifs: check hash calculating succeeded
authorLuis de Bethencourt <luisbg@osg.samsung.com>
Wed, 8 Jun 2016 16:02:32 +0000 (17:02 +0100)
committerSteve French <smfrench@gmail.com>
Fri, 24 Jun 2016 04:45:17 +0000 (23:45 -0500)
calc_lanman_hash() could return -ENOMEM or other errors, we should check
that everything went fine before using the calculated key.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/sess.c

index a42e99c8e00ea2e770d949e37b4b1ac8d9b879ef..538d9b55699a10f1185b8df25a1f36f9a24ae75c 100644 (file)
@@ -710,6 +710,8 @@ sess_auth_lanman(struct sess_data *sess_data)
                rc = calc_lanman_hash(ses->password, ses->server->cryptkey,
                                      ses->server->sec_mode & SECMODE_PW_ENCRYPT ?
                                      true : false, lnm_session_key);
+               if (rc)
+                       goto out;
 
                memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_AUTH_RESP_SIZE);
                bcc_ptr += CIFS_AUTH_RESP_SIZE;