render / rpms / qemu

Forked from rpms/qemu 5 months ago
Clone

Blame 0204-e1000-bounds-packet-size-against-buffer-size.patch

cd9d16
From 078c531e6b57f36359b74ea6c136c2ea1b5a9891 Mon Sep 17 00:00:00 2001
cd9d16
From: Anthony Liguori <aliguori@us.ibm.com>
cd9d16
Date: Mon, 23 Jan 2012 07:30:43 -0600
cd9d16
Subject: [PATCH] e1000: bounds packet size against buffer size
cd9d16
MIME-Version: 1.0
cd9d16
Content-Type: text/plain; charset=UTF-8
cd9d16
Content-Transfer-Encoding: 8bit
cd9d16
cd9d16
Otherwise we can write beyond the buffer and corrupt memory.  This is tracked
cd9d16
as CVE-2012-0029.
cd9d16
cd9d16
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cd9d16
(cherry picked from commit 65f82df0d7a71ce1b10cd4c5ab08888d176ac840)
cd9d16
cd9d16
Signed-off-by: Bruce Rogers <brogers@suse.com>
cd9d16
[AF: stable-0.15 does not have pci_dma_read(). Fixes BNC#740165.]
cd9d16
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d16
---
cd9d16
 hw/e1000.c | 3 +++
cd9d16
 1 file changed, 3 insertions(+)
cd9d16
cd9d16
diff --git a/hw/e1000.c b/hw/e1000.c
cd9d16
index 7971457..c91790b 100644
cd9d16
--- a/hw/e1000.c
cd9d16
+++ b/hw/e1000.c
cd9d16
@@ -472,6 +472,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
cd9d16
             bytes = split_size;
cd9d16
             if (tp->size + bytes > msh)
cd9d16
                 bytes = msh - tp->size;
cd9d16
+
cd9d16
+            bytes = MIN(sizeof(tp->data) - tp->size, bytes);
cd9d16
             cpu_physical_memory_read(addr, tp->data + tp->size, bytes);
cd9d16
             if ((sz = tp->size + bytes) >= hdr && tp->size < hdr)
cd9d16
                 memmove(tp->header, tp->data, hdr);
cd9d16
@@ -487,6 +489,7 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
cd9d16
         // context descriptor TSE is not set, while data descriptor TSE is set
cd9d16
         DBGOUT(TXERR, "TCP segmentaion Error\n");
cd9d16
     } else {
cd9d16
+        split_size = MIN(sizeof(tp->data) - tp->size, split_size);
cd9d16
         cpu_physical_memory_read(addr, tp->data + tp->size, split_size);
cd9d16
         tp->size += split_size;
cd9d16
     }
cd9d16
-- 
cd9d16
1.7.11.2
cd9d16