From patchwork Wed Mar 31 07:34:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/17] virtio-serial: Send out guest data to ports only if port is opened Date: Tue, 30 Mar 2010 21:34:01 -0000 From: Amit Shah X-Patchwork-Id: 49113 Message-Id: <1270020848-15526-11-git-send-email-amit.shah@redhat.com> To: qemu list Cc: Amit Shah , "Michael S. Tsirkin" , Gerd Hoffmann , Juan Quintela Data should be written only when ports are open. Signed-off-by: Amit Shah --- hw/virtio-serial-bus.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 33083af..236e300 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -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