]> xenbits.xensource.com Git - qemu-upstream-4.2-testing.git/commitdiff
e1000: Discard oversized packets based on SBP|LPE
authorMichael Contreras <michael@inetric.com>
Thu, 17 Jan 2013 11:49:37 +0000 (11:49 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 17 Jan 2013 11:49:37 +0000 (11:49 +0000)
Discard packets longer than 16384 when !SBP to match the hardware behavior.

upstream-commit-id: 2c0331f4f7d241995452b99afaf0aab00493334a
security-tags: XSA-41, CVE-2012-6075
This is the second of two security fixes for XSA-41.

Signed-off-by: Michael Contreras <michael@inetric.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/e1000.c

index 37d207eaca52a6c2701a7aca3b286d66be6057dc..a5e67a881793afdd86fad873127256eaca46b852 100644 (file)
@@ -61,6 +61,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:
@@ -697,8 +699,9 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t 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;
     }