File CVE-2015-6815-qemuu-e1000-fix-infinite-loop.patch of Package xen.1317

References: bsc#944697

From: P J P <address@hidden>

While processing transmit descriptors, it could lead to an infinite
loop if 'bytes' was to become zero; Add a check to avoid it.

[The guest can force 'bytes' to 0 by setting the hdr_len and mss
descriptor fields to 0.
--Stefan]

Signed-off-by: P J P <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 hw/net/e1000.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: xen-4.4.3-testing/tools/qemu-xen-dir-remote/hw/net/e1000.c
===================================================================
--- xen-4.4.3-testing.orig/tools/qemu-xen-dir-remote/hw/net/e1000.c
+++ xen-4.4.3-testing/tools/qemu-xen-dir-remote/hw/net/e1000.c
@@ -633,7 +633,8 @@ process_tx_desc(E1000State *s, struct e1
                 memmove(tp->data, tp->header, tp->hdr_len);
                 tp->size = tp->hdr_len;
             }
-        } while (split_size -= bytes);
+            split_size -= bytes;
+        } while (bytes && split_size);
     } else if (!tp->tse && tp->cptse) {
         // context descriptor TSE is not set, while data descriptor TSE is set
         DBGOUT(TXERR, "TCP segmentation error\n");
openSUSE Build Service is sponsored by