1 From 126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c Mon Sep 17 00:00:00 2001
2 From: Nicholas Mc Guire <hofrat@osadl.org>
3 Date: Thu, 23 Aug 2018 12:24:02 +0200
4 Subject: cifs: check kmalloc before use
6 From: Nicholas Mc Guire <hofrat@osadl.org>
8 commit 126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c upstream.
10 The kmalloc was not being checked - if it fails issue a warning
11 and return -ENOMEM to the caller.
13 Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
14 Fixes: b8da344b74c8 ("cifs: dynamic allocation of ntlmssp blob")
15 Signed-off-by: Steve French <stfrench@microsoft.com>
16 Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
17 cc: Stable <stable@vger.kernel.org>`
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 fs/cifs/sess.c | 6 ++++++
22 1 file changed, 6 insertions(+)
26 @@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned cha
27 goto setup_ntlmv2_ret;
29 *pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
32 + cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
34 + goto setup_ntlmv2_ret;
36 sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;
38 memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);