virtio: fix descriptor counting in virtqueue_pop
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 20 Sep 2017 06:09:33 +0000 (08:09 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 15 Oct 2017 02:54:44 +0000 (05:54 +0300)
commit37ef70be6af7e9f2a6f852c68f74bd98dac2664b
tree827770663eae17214eeb785fc21a315e8a70d759
parent8e36c336d943c3bfe0d06f5465cc64d44b306e13
virtio: fix descriptor counting in virtqueue_pop

While changing the s/g list allocation, commit 3b3b0628
also changed the descriptor counting to count iovec entries
as split by cpu_physical_memory_map(). Previously only the
actual descriptor entries were counted and the split into
the iovec happened afterwards in virtqueue_map().
Count the entries again instead to avoid erroneous
"Looped descriptor" errors.

Reported-by: Hans Middelhoek <h.middelhoek@ospito.nl>
Link: https://forum.proxmox.com/threads/vm-crash-with-memory-hotplug.35904/
Fixes: 3b3b0628217e ("virtio: slim down allocation of VirtQueueElements")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c