cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-rtl8139-skip-offload-on-short-Ethernet-IP-header-CVE.patch

05bba0
From 87c927af369a24b466b9429e9c785219ea718863 Mon Sep 17 00:00:00 2001
b2d9fb
From: Stefan Hajnoczi <stefanha@redhat.com>
b2d9fb
Date: Fri, 31 Jul 2015 15:59:44 +0200
05bba0
Subject: [PATCH 09/13] rtl8139: skip offload on short Ethernet/IP header
b2d9fb
 (CVE-2015-5165)
b2d9fb
b2d9fb
Message-id: <1438358388-10575-4-git-send-email-stefanha@redhat.com>
b2d9fb
Patchwork-id: 67237
b2d9fb
O-Subject: [RHEL-7.1.z qemu-kvm EMBARGOED PATCH 3/7] rtl8139: skip offload on short Ethernet/IP header (CVE-2015-5165)
05bba0
Bugzilla: 1248766
b2d9fb
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
b2d9fb
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
b2d9fb
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
b2d9fb
b2d9fb
Transmit offload features access Ethernet and IP headers the packet.  If
b2d9fb
the packet is too short we must not attempt to access header fields:
b2d9fb
b2d9fb
  int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12));
b2d9fb
  ...
b2d9fb
  eth_payload_data = saved_buffer + ETH_HLEN;
b2d9fb
  ...
b2d9fb
  ip = (ip_header*)eth_payload_data;
b2d9fb
  if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
b2d9fb
b2d9fb
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
b2d9fb
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b2d9fb
---
b2d9fb
 hw/net/rtl8139.c | 5 +++++
b2d9fb
 1 file changed, 5 insertions(+)
b2d9fb
b2d9fb
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
b2d9fb
index ab32714..409029d 100644
b2d9fb
--- a/hw/net/rtl8139.c
b2d9fb
+++ b/hw/net/rtl8139.c
b2d9fb
@@ -2142,6 +2142,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
b2d9fb
         {
b2d9fb
             DPRINTF("+++ C+ mode offloaded task checksum\n");
b2d9fb
 
b2d9fb
+            /* Large enough for Ethernet and IP headers? */
b2d9fb
+            if (saved_size < ETH_HLEN + sizeof(ip_header)) {
b2d9fb
+                goto skip_offload;
b2d9fb
+            }
b2d9fb
+
b2d9fb
             /* ip packet header */
b2d9fb
             ip_header *ip = NULL;
b2d9fb
             int hlen = 0;
b2d9fb
-- 
b2d9fb
1.8.3.1
b2d9fb