aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-09-06 05:47:01 -0400
committerSteve French <stfrench@microsoft.com>2018-09-12 18:13:34 -0400
commit097f5863b1a0c9901f180bbd56ae7d630655faaa (patch)
tree1e6fd772fd570b6d27dd02ce1a31029d0939e7b0
parent2d204ee9d671327915260071c19350d84344e096 (diff)
cifs: read overflow in is_valid_oplock_break()
We need to verify that the "data_offset" is within bounds. Reported-by: Dr Silvio Cesare of InfoSect <silvio.cesare@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
-rw-r--r--fs/cifs/misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index dacb2c05674c..6926685e513c 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -402,9 +402,17 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
402 (struct smb_com_transaction_change_notify_rsp *)buf; 402 (struct smb_com_transaction_change_notify_rsp *)buf;
403 struct file_notify_information *pnotify; 403 struct file_notify_information *pnotify;
404 __u32 data_offset = 0; 404 __u32 data_offset = 0;
405 size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length);
406
405 if (get_bcc(buf) > sizeof(struct file_notify_information)) { 407 if (get_bcc(buf) > sizeof(struct file_notify_information)) {
406 data_offset = le32_to_cpu(pSMBr->DataOffset); 408 data_offset = le32_to_cpu(pSMBr->DataOffset);
407 409
410 if (data_offset >
411 len - sizeof(struct file_notify_information)) {
412 cifs_dbg(FYI, "invalid data_offset %u\n",
413 data_offset);
414 return true;
415 }
408 pnotify = (struct file_notify_information *) 416 pnotify = (struct file_notify_information *)
409 ((char *)&pSMBr->hdr.Protocol + data_offset); 417 ((char *)&pSMBr->hdr.Protocol + data_offset);
410 cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n", 418 cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",