diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 09e22aa44a2cdd031ce3e4b657453751cdc55fad..e05ab5e609691f0b04b55f061d16a5302455dfe3 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -117,6 +117,9 @@ static void discard_vq_data(VirtQueue *vq, VirtIODevice *vdev) { VirtQueueElement elem; + if (!virtio_queue_ready(vq)) { + return; + } while (virtqueue_pop(vq, &elem)) { virtqueue_push(vq, &elem, 0); }