eaa6ce4fe2
CVE-2017-5525: audio: memory leakage in ac97 (bz #1414110) CVE-2017-5526: audio: memory leakage in es1370 (bz #1414210) CVE-2016-10155 watchdog: memory leakage in i6300esb (bz #1415200) CVE-2017-5552: virtio-gpu-3d: memory leakage (bz #1415283) CVE-2017-5578: virtio-gpu: memory leakage (bz #1415797) CVE-2017-5667: sd: sdhci OOB access during multi block transfer (bz #1417560) CVE-2017-5856: scsi: megasas: memory leakage (bz #1418344) CVE-2017-5857: virtio-gpu-3d: host memory leakage in virgl_cmd_resource_unref (bz #1418383) CVE-2017-5898: usb: integer overflow in emulated_apdu_from_guest (bz #1419700) CVE-2017-5987: sd: infinite loop issue in multi block transfers (bz #1422001) CVE-2017-6058: vmxnet3: OOB access when doing vlan stripping (bz #1423359) CVE-2017-6505: usb: an infinite loop issue in ohci_service_ed_list (bz #1429434) CVE-2017-2615: cirrus: oob access while doing bitblt copy backward (bz #1418206) CVE-2017-2620: cirrus: potential arbitrary code execution (bz #1425419) Fix spice GL with new mesa/libglvnd (bz #1431905)
126 lines
3.7 KiB
Diff
126 lines
3.7 KiB
Diff
From: Dmitry Fleytman <dmitry@daynix.com>
|
|
Date: Thu, 16 Feb 2017 14:29:32 +0200
|
|
Subject: [PATCH] eth: Extend vlan stripping functions
|
|
|
|
Make VLAN stripping functions return number of bytes
|
|
copied to given Ethernet header buffer.
|
|
|
|
This information should be used to re-compose
|
|
packet IOV after VLAN stripping.
|
|
|
|
Cc: qemu-stable@nongnu.org
|
|
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
|
|
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
(cherry picked from commit 566342c3125ac2e73abd36c650222318164517ed)
|
|
---
|
|
include/net/eth.h | 4 ++--
|
|
net/eth.c | 25 ++++++++++++++-----------
|
|
2 files changed, 16 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/include/net/eth.h b/include/net/eth.h
|
|
index 2013175..afeb45b 100644
|
|
--- a/include/net/eth.h
|
|
+++ b/include/net/eth.h
|
|
@@ -331,12 +331,12 @@ eth_get_pkt_tci(const void *p)
|
|
}
|
|
}
|
|
|
|
-bool
|
|
+size_t
|
|
eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
uint8_t *new_ehdr_buf,
|
|
uint16_t *payload_offset, uint16_t *tci);
|
|
|
|
-bool
|
|
+size_t
|
|
eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
uint16_t vet, uint8_t *new_ehdr_buf,
|
|
uint16_t *payload_offset, uint16_t *tci);
|
|
diff --git a/net/eth.c b/net/eth.c
|
|
index df81efb..5b9ba26 100644
|
|
--- a/net/eth.c
|
|
+++ b/net/eth.c
|
|
@@ -232,7 +232,7 @@ void eth_get_protocols(const struct iovec *iov, int iovcnt,
|
|
}
|
|
}
|
|
|
|
-bool
|
|
+size_t
|
|
eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
uint8_t *new_ehdr_buf,
|
|
uint16_t *payload_offset, uint16_t *tci)
|
|
@@ -244,7 +244,7 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
new_ehdr, sizeof(*new_ehdr));
|
|
|
|
if (copied < sizeof(*new_ehdr)) {
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
switch (be16_to_cpu(new_ehdr->h_proto)) {
|
|
@@ -254,7 +254,7 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
&vlan_hdr, sizeof(vlan_hdr));
|
|
|
|
if (copied < sizeof(vlan_hdr)) {
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
new_ehdr->h_proto = vlan_hdr.h_proto;
|
|
@@ -268,18 +268,21 @@ eth_strip_vlan(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
PKT_GET_VLAN_HDR(new_ehdr), sizeof(vlan_hdr));
|
|
|
|
if (copied < sizeof(vlan_hdr)) {
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
*payload_offset += sizeof(vlan_hdr);
|
|
+
|
|
+ return sizeof(struct eth_header) + sizeof(struct vlan_header);
|
|
+ } else {
|
|
+ return sizeof(struct eth_header);
|
|
}
|
|
- return true;
|
|
default:
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
-bool
|
|
+size_t
|
|
eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
uint16_t vet, uint8_t *new_ehdr_buf,
|
|
uint16_t *payload_offset, uint16_t *tci)
|
|
@@ -291,7 +294,7 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
new_ehdr, sizeof(*new_ehdr));
|
|
|
|
if (copied < sizeof(*new_ehdr)) {
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
if (be16_to_cpu(new_ehdr->h_proto) == vet) {
|
|
@@ -299,17 +302,17 @@ eth_strip_vlan_ex(const struct iovec *iov, int iovcnt, size_t iovoff,
|
|
&vlan_hdr, sizeof(vlan_hdr));
|
|
|
|
if (copied < sizeof(vlan_hdr)) {
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
new_ehdr->h_proto = vlan_hdr.h_proto;
|
|
|
|
*tci = be16_to_cpu(vlan_hdr.h_tci);
|
|
*payload_offset = iovoff + sizeof(*new_ehdr) + sizeof(vlan_hdr);
|
|
- return true;
|
|
+ return sizeof(struct eth_header);
|
|
}
|
|
|
|
- return false;
|
|
+ return 0;
|
|
}
|
|
|
|
void
|