Skip to content

Commit 126c97f

Browse files
Nicholas Mc Guiresmfrench
authored andcommitted
cifs: check kmalloc before use
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]>`
1 parent e6c47dd commit 126c97f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/cifs/sess.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
398398
goto setup_ntlmv2_ret;
399399
}
400400
*pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
401+
if (!*pbuffer) {
402+
rc = -ENOMEM;
403+
cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
404+
*buflen = 0;
405+
goto setup_ntlmv2_ret;
406+
}
401407
sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;
402408

403409
memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);

0 commit comments

Comments
 (0)