]> xenbits.xensource.com Git - qemu-xen-4.1-testing.git/commitdiff
e1000: Discard oversized packets based on SBP|LPE
authorMichael Contreras <michael@inetric.com>
Wed, 5 Dec 2012 18:31:30 +0000 (13:31 -0500)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 17 Jan 2013 12:11:01 +0000 (12:11 +0000)
Discard packets longer than 16384 when !SBP to match the hardware behavior.

Signed-off-by: Michael Contreras <michael@inetric.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 2c0331f4f7d241995452b99afaf0aab00493334a)
[ This is a security vulnerablity, XSA-41 / CVE-2012-6075 (2nd patch). ]
(cherry picked from commit e33f918c19e393900b95a2bb6b10668dfe96a8f2)

hw/e1000.c

index f0673f0048d27ca72850c61564941129778aa81f..67d265130c410d0de27741dc75ce4cc415f41ad5 100644 (file)
@@ -57,6 +57,8 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
 
 /* this is the size past which hardware will drop packets when setting LPE=0 */
 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
+/* this is the size past which hardware will drop packets when setting LPE=1 */
+#define MAXIMUM_ETHERNET_LPE_SIZE 16384
 
 /*
  * HW models:
@@ -632,8 +634,9 @@ e1000_receive(void *opaque, const uint8_t *buf, int size)
     }
 
     /* Discard oversized packets if !LPE and !SBP. */
-    if (size > MAXIMUM_ETHERNET_VLAN_SIZE
-        && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
+    if ((size > MAXIMUM_ETHERNET_LPE_SIZE ||
+        (size > MAXIMUM_ETHERNET_VLAN_SIZE
+        && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
         && !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
         return size;
     }