repository: C:/dev/kvm-guest-drivers-windows
branch: master
commit 66bd286cd172099ae62c8a7db0fb95ccba8b071b
Author: Yan Vugenfirer <[email protected]>
Date:   Sun Oct 25 14:53:41 2009 +0200

    On SMP guests, reads from the ring might bypass used index reads. This 
causes guest crashes because host writes to used index to signal ring data 
readiness.
    Fix this by inserting rmb before used ring reads.
    
    Original fix for Linux guest by Michael S. Tsirkin <[email protected]>
    Signed-off-by: Yan Vugenfirer <[email protected]>

diff --git a/VirtIO/VirtIORing.c b/VirtIO/VirtIORing.c
index 0151472..42040e6 100644
--- a/VirtIO/VirtIORing.c
+++ b/VirtIO/VirtIORing.c
@@ -248,6 +248,9 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned 
int *len)
                return NULL;
        }
 
+       /* Only get used array entries after they have been exposed by host. */
+       rmb();
+
        i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id;
        *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len;
 
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to