peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0004-e1000-Avoid-infinite-loop-in-processing-transmit-des.patch

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