[Spice-devel] [PATCH qemu-kvm-rhel6] Don't crash (on an assert) when the agent sends multiple messages

Hans de Goede hdegoede at redhat.com
Tue Oct 12 23:18:09 PDT 2010


Don't crash (on an assert) when the agent sends multiple messages
in quick succession. The solution was taken from the current qemu-spice
code.
---
 hw/spice-vmc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/spice-vmc.c b/hw/spice-vmc.c
index 9a20952..8f1417b 100644
--- a/hw/spice-vmc.c
+++ b/hw/spice-vmc.c
@@ -120,6 +120,8 @@ static int spice_vmc_interface_read(
         assert(svc->datalen >= 0);
         if (svc->datalen == 0) {
             svc->datapos = NULL;
+            virtio_serial_throttle_port(&svc->vserport, false);
+            // ^^^ !!! may call vmc_have_data, so don't touch svc after it!
         }
     }
     return bytes;
@@ -213,6 +215,7 @@ static void spice_vmc_have_data(
     svc->datapos = (uint8_t*)buf;
     svc->datalen = len;
     dprintf(svc, 2, "%s: %p %d\n", __func__, svc->datapos, svc->datalen);
+    virtio_serial_throttle_port(&svc->vserport, true);
     if (svc->plug) {
         svc->plug->wakeup(svc->plug);
     }
-- 
1.7.3.1



More information about the Spice-devel mailing list