ksmbd: Use unsafe_memcpy() for ntlm_negotiate
commit dfd046d0ced19b6ff5f11ec4ceab0a83de924771 upstream. rsp buffer is allocated larger than spnego_blob from smb2_allocate_rsp_buf(). Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8302adf60a
commit
107a48df3f
@@ -1380,7 +1380,8 @@ static int ntlm_negotiate(struct ksmbd_work *work,
|
||||
}
|
||||
|
||||
sz = le16_to_cpu(rsp->SecurityBufferOffset);
|
||||
memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len);
|
||||
unsafe_memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len,
|
||||
/* alloc is larger than blob, see smb2_allocate_rsp_buf() */);
|
||||
rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len);
|
||||
|
||||
out:
|
||||
@@ -1463,7 +1464,9 @@ static int ntlm_authenticate(struct ksmbd_work *work,
|
||||
return -ENOMEM;
|
||||
|
||||
sz = le16_to_cpu(rsp->SecurityBufferOffset);
|
||||
memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob, spnego_blob_len);
|
||||
unsafe_memcpy((char *)&rsp->hdr.ProtocolId + sz, spnego_blob,
|
||||
spnego_blob_len,
|
||||
/* alloc is larger than blob, see smb2_allocate_rsp_buf() */);
|
||||
rsp->SecurityBufferLength = cpu_to_le16(spnego_blob_len);
|
||||
kfree(spnego_blob);
|
||||
}
|
||||
|
Reference in New Issue
Block a user