linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: check hash calculating succeeded
@ 2016-06-08 16:02 Luis de Bethencourt
  0 siblings, 0 replies; only message in thread
From: Luis de Bethencourt @ 2016-06-08 16:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: sfrench, linux-cifs, samba-technical, Luis de Bethencourt

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>
---
 fs/cifs/sess.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index a42e99c..538d9b5 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -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;
-- 
2.5.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-08 16:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 16:02 [PATCH] cifs: check hash calculating succeeded Luis de Bethencourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).