Patchwork [2/2] virtio-serial: Assert for virtio queue ready before virtqueue operations

login
register
mail settings
Submitter Amit Shah
Date July 1, 2010, 9:28 a.m.
Message ID <8ce10459eabf04b762594fcf9a392e87e42f7ae0.1277976486.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/57496/
State New
Headers show

Comments

Amit Shah - July 1, 2010, 9:28 a.m.
In addition to the previous fix for calling do_flush_queued_data() only
when the virtqueue is ready, ensure do_flush_queued_data() gets a vq
that's suitably initialised.

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

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index b89daa6..93cffa2 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -117,6 +117,7 @@  static void do_flush_queued_data(VirtIOSerialPort *port, VirtQueue *vq,
     VirtQueueElement elem;
 
     assert(port || discard);
+    assert(virtio_queue_ready(vq));
 
     while ((discard || !port->throttled) && virtqueue_pop(vq, &elem)) {
         uint8_t *buf;