[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-xen-traditional master] rtl8139: skip offload on short Ethernet/IP header
commit 8d3ca030c3bea00fa7212518f13cec62f41b4d5e Author: Stefan Hajnoczi <stefanha@xxxxxxxxxx> AuthorDate: Wed Jul 15 18:17:00 2015 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue May 10 19:11:43 2016 +0100 rtl8139: skip offload on short Ethernet/IP header Transmit offload features access Ethernet and IP headers the packet. If the packet is too short we must not attempt to access header fields: int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12)); ... eth_payload_data = saved_buffer + ETH_HLEN; ... ip = (ip_header*)eth_payload_data; if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) { Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx> [Backport to qemu-xen-tradition] Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- hw/rtl8139.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 8b17bd9..75ef9b4 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -2103,6 +2103,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) #define ETH_HLEN 14 #define ETH_MTU 1500 + /* Large enough for Ethernet and IP headers? */ + if (saved_size < ETH_HLEN + sizeof(ip_header)) { + goto skip_offload; + } + /* ip packet header */ ip_header *ip = 0; int hlen = 0; -- generated by git-patchbot for /home/xen/git/qemu-xen-traditional.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |