Skip to content

Commit 097f586

Browse files
Dan CarpenterSteve French
authored andcommitted
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 <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Steve French <[email protected]> Reviewed-by: Aurelien Aptel <[email protected]>
1 parent 2d204ee commit 097f586

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/cifs/misc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,17 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
402402
(struct smb_com_transaction_change_notify_rsp *)buf;
403403
struct file_notify_information *pnotify;
404404
__u32 data_offset = 0;
405+
size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length);
406+
405407
if (get_bcc(buf) > sizeof(struct file_notify_information)) {
406408
data_offset = le32_to_cpu(pSMBr->DataOffset);
407409

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+
}
408416
pnotify = (struct file_notify_information *)
409417
((char *)&pSMBr->hdr.Protocol + data_offset);
410418
cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",

0 commit comments

Comments
 (0)