[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table



commit 358bb0daa1ce332a18cc996fcd078a3989f77d36
Author:     yinyin <yin.yin@xxxxxxxxxxx>
AuthorDate: Thu Aug 22 14:47:16 2013 +0800
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Tue Sep 24 19:36:15 2013 -0500

    virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect 
descriptor table
    
    virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
               /* loop over the indirect descriptor table */
               indirect = 1;
               max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
               num_bufs = i = 0;
               desc_pa = vring_desc_addr(desc_pa, i);
    But, It init i to 0, then use i to update desc_pa. so we will always get:
    desc_pa = vring_desc_addr(desc_pa, 0);
    the last two line should swap.
    
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Yin Yin <yin.yin@xxxxxxxxxxx>
    Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    (cherry picked from commit 1ae2757c6c4525c9b42f408c86818f843bad7418)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/virtio/virtio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index f03c45d..2f1e73b 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -377,8 +377,8 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int 
*in_bytes,
             /* loop over the indirect descriptor table */
             indirect = 1;
             max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
-            num_bufs = i = 0;
             desc_pa = vring_desc_addr(desc_pa, i);
+            num_bufs = i = 0;
         }
 
         do {
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.