On Mon, 13 Mar 2017 14:29:41 +0800
Jason Wang <address@hidden> wrote:
To avoid access stale memory region cache after reset, this patch
check the existence of virtqueue pfn for all exported virtqueue access
helpers before trying to use them.
Cc: Cornelia Huck <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
hw/virtio/virtio.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index efce4b3..76cc81b 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -322,6 +322,10 @@ static int virtio_queue_empty_rcu(VirtQueue *vq)
return 0;
}
+ if (unlikely(!vq->vring.avail)) {
+ return 0;
Shouldn't that rather return !0 (denoting a non-existing queue as
empty)?