Skip to content

Commit

Permalink
cifs: check kmalloc before use
Browse files Browse the repository at this point in the history
The kmalloc was not being checked - if it fails issue a warning
and return -ENOMEM to the caller.

Signed-off-by: Nicholas Mc Guire <[email protected]>
Fixes: b8da344 ("cifs: dynamic allocation of ntlmssp blob")
Signed-off-by: Steve French <[email protected]>
Reviewed-by: Pavel Shilovsky <[email protected]>
cc: Stable <[email protected]>`
  • Loading branch information
Nicholas Mc Guire authored and Steve French committed Aug 23, 2018
1 parent e6c47dd commit 126c97f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/cifs/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
goto setup_ntlmv2_ret;
}
*pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
if (!*pbuffer) {
rc = -ENOMEM;
cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
*buflen = 0;
goto setup_ntlmv2_ret;
}
sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;

memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
Expand Down

0 comments on commit 126c97f

Please sign in to comment.