virtio: handle virtqueue_map_desc() errors
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 21 Sep 2016 15:52:21 +0000 (16:52 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 23 Sep 2016 16:03:55 +0000 (19:03 +0300)
commitec55da192403e4a1e05f767c8762273d43ea7da4
tree29f5bf0e96631a8b1d84a666427fecd85659ce6b
parent791b1daf724ea835a32e90b2b15df1e20dae6f57
virtio: handle virtqueue_map_desc() errors

Errors can occur during virtqueue_pop(), especially in
virtqueue_map_desc().  In order to handle this we must unmap iov[]
before returning NULL.  The caller will consider the virtqueue empty and
the virtio_error() call will have marked the device broken.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c