095c481
From 00d751038d501ab40298ebe972addfcf4ea0c54b Mon Sep 17 00:00:00 2001
095c481
From: P J P <pjp@fedoraproject.org>
095c481
Date: Fri, 4 Sep 2015 17:21:06 +0100
095c481
Subject: [PATCH] e1000: Avoid infinite loop in processing transmit descriptor (CVE-2015-6815)
095c481
095c481
While processing transmit descriptors, it could lead to an infinite
095c481
loop if 'bytes' was to become zero; Add a check to avoid it.
095c481
095c481
[The guest can force 'bytes' to 0 by setting the hdr_len and mss
095c481
descriptor fields to 0.
095c481
--Stefan]
095c481
095c481
upstream-commit-id: b947ac2bf26479e710489739c465c8af336599e7
095c481
095c481
Signed-off-by: P J P <pjp@fedoraproject.org>
095c481
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
095c481
Reviewed-by: Thomas Huth <thuth@redhat.com>
095c481
Message-id: 1441383666-6590-1-git-send-email-stefanha@redhat.com
095c481
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
095c481
---
095c481
 hw/net/e1000.c |    3 ++-
095c481
 1 files changed, 2 insertions(+), 1 deletions(-)
095c481
095c481
diff --git a/tools/qemu-xen/hw/net/e1000.c b/tools/qemu-xen/hw/net/e1000.c
095c481
index e33a4da..3032855 100644
095c481
--- a/tools/qemu-xen/hw/net/e1000.c
095c481
+++ b/tools/qemu-xen/hw/net/e1000.c
095c481
@@ -736,7 +736,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
095c481
                 memmove(tp->data, tp->header, tp->hdr_len);
095c481
                 tp->size = tp->hdr_len;
095c481
             }
095c481
-        } while (split_size -= bytes);
095c481
+            split_size -= bytes;
095c481
+        } while (bytes && split_size);
095c481
     } else if (!tp->tse && tp->cptse) {
095c481
         // context descriptor TSE is not set, while data descriptor TSE is set
095c481
         DBGOUT(TXERR, "TCP segmentation error\n");
095c481
-- 
095c481
1.7.2.5
095c481