]> git.ipfire.org Git - thirdparty/qemu.git/commit
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor...
authoryinyin <yin.yin@cs2c.com.cn>
Thu, 22 Aug 2013 06:47:16 +0000 (14:47 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 25 Sep 2013 00:36:15 +0000 (19:36 -0500)
commit358bb0daa1ce332a18cc996fcd078a3989f77d36
tree4e6d603543d61b54ff66fc6feeceb844385b63ba
parent3fe494efc5eb107c4c90e96df3e6131f9960f4b9
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@nongnu.org
Signed-off-by: Yin Yin <yin.yin@cs2c.com.cn>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1ae2757c6c4525c9b42f408c86818f843bad7418)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio.c