]>
Commit | Line | Data |
---|---|---|
80347ec8 GKH |
1 | From foo@baz Mon Oct 8 18:01:43 CEST 2018 |
2 | From: Dan Carpenter <dan.carpenter@oracle.com> | |
3 | Date: Thu, 6 Sep 2018 12:47:01 +0300 | |
4 | Subject: cifs: read overflow in is_valid_oplock_break() | |
5 | ||
6 | From: Dan Carpenter <dan.carpenter@oracle.com> | |
7 | ||
8 | [ Upstream commit 097f5863b1a0c9901f180bbd56ae7d630655faaa ] | |
9 | ||
10 | We need to verify that the "data_offset" is within bounds. | |
11 | ||
12 | Reported-by: Dr Silvio Cesare of InfoSect <silvio.cesare@gmail.com> | |
13 | Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> | |
14 | Signed-off-by: Steve French <stfrench@microsoft.com> | |
15 | Reviewed-by: Aurelien Aptel <aaptel@suse.com> | |
16 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
17 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
18 | --- | |
19 | fs/cifs/misc.c | 8 ++++++++ | |
20 | 1 file changed, 8 insertions(+) | |
21 | ||
22 | --- a/fs/cifs/misc.c | |
23 | +++ b/fs/cifs/misc.c | |
24 | @@ -406,9 +406,17 @@ is_valid_oplock_break(char *buffer, stru | |
25 | (struct smb_com_transaction_change_notify_rsp *)buf; | |
26 | struct file_notify_information *pnotify; | |
27 | __u32 data_offset = 0; | |
28 | + size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length); | |
29 | + | |
30 | if (get_bcc(buf) > sizeof(struct file_notify_information)) { | |
31 | data_offset = le32_to_cpu(pSMBr->DataOffset); | |
32 | ||
33 | + if (data_offset > | |
34 | + len - sizeof(struct file_notify_information)) { | |
35 | + cifs_dbg(FYI, "invalid data_offset %u\n", | |
36 | + data_offset); | |
37 | + return true; | |
38 | + } | |
39 | pnotify = (struct file_notify_information *) | |
40 | ((char *)&pSMBr->hdr.Protocol + data_offset); | |
41 | cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n", |