Patchwork [11/15] virtio-serial: Send out guest data to ports only if port is opened

login
register
mail settings
Submitter Amit Shah
Date March 24, 2010, 2:49 p.m.
Message ID <1269442173-18421-12-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/48430/
State New
Headers show

Comments

Amit Shah - March 24, 2010, 2:49 p.m.
Data should be written only when ports are open.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-serial-bus.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index efcc66c..80fbff4 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -350,6 +350,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