aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-serial-bus.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-07-01 14:58:16 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-07-13 09:06:58 -0500
commit6b611d3ab820d6e3b30a23ebac69df04ab0105a0 (patch)
treeb782027d4ee284f45ac8f400c61f247fe4faa7a3 /hw/virtio-serial-bus.c
parenta03c54f16eb35df6f8a08255cf44230a194c50bc (diff)
virtio-serial: Check if virtio queue is ready before consuming data
If a virtio-serial port is removed before the guest comes up and initialises the virtqueues, qemu exits with the message Guest moved used index from 0 to 61440 This happens because we try to clear any pending buffers from the virtqueue. Ensure the virtqueue is initialised before calling any virtqueue operations. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-serial-bus.c')
-rw-r--r--hw/virtio-serial-bus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 26d5841154..077c3183bc 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -139,6 +139,9 @@ static void flush_queued_data(VirtIOSerialPort *port, bool discard)
{
assert(port);
+ if (!virtio_queue_ready(port->ovq)) {
+ return;
+ }
do_flush_queued_data(port, port->ovq, &port->vser->vdev, discard);
}