mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ksmbd: validate request buffer size in smb2_allocate_rsp_buf()
commit 17cf0c2794bdb6f39671265aa18aea5c22ee8c4a upstream. The response buffer should be allocated in smb2_allocate_rsp_buf before validating request. But the fields in payload as well as smb2 header is used in smb2_allocate_rsp_buf(). This patch add simple buffer size validation to avoid potencial out-of-bounds in request buffer. Cc: stable@vger.kernel.org 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
b80ba64871
commit
21ff9d7d22
@@ -534,6 +534,10 @@ int smb2_allocate_rsp_buf(struct ksmbd_work *work)
|
|||||||
if (cmd == SMB2_QUERY_INFO_HE) {
|
if (cmd == SMB2_QUERY_INFO_HE) {
|
||||||
struct smb2_query_info_req *req;
|
struct smb2_query_info_req *req;
|
||||||
|
|
||||||
|
if (get_rfc1002_len(work->request_buf) <
|
||||||
|
offsetof(struct smb2_query_info_req, OutputBufferLength))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
req = smb2_get_msg(work->request_buf);
|
req = smb2_get_msg(work->request_buf);
|
||||||
if ((req->InfoType == SMB2_O_INFO_FILE &&
|
if ((req->InfoType == SMB2_O_INFO_FILE &&
|
||||||
(req->FileInfoClass == FILE_FULL_EA_INFORMATION ||
|
(req->FileInfoClass == FILE_FULL_EA_INFORMATION ||
|
||||||
|
|||||||
Reference in New Issue
Block a user