virtio-serial: Send out guest data to ports only if port is opened
authorAmit Shah <amit.shah@redhat.com>
Tue, 27 Apr 2010 12:34:04 +0000 (18:04 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 28 Apr 2010 13:58:21 +0000 (08:58 -0500)
Data should be written only when ports are open.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/virtio-serial-bus.c

index 3a09f0d3c631485c6240f0bad73a0c627719c58c..6befd4d139c5f676cd120739880c452869fd6876 100644 (file)
@@ -335,6 +335,11 @@ static void handle_output(VirtIODevice *vdev, VirtQueue *vq)
             goto next_buf;
         }
 
+       if (!port->host_connected) {
+            ret = 0;
+            goto next_buf;
+        }
+
         /*
          * A port may not have any handler registered for consuming the
          * data that the guest sends or it may not have a chardev associated