virtio: handle virtqueue_num_heads() errors
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 21 Sep 2016 15:52:25 +0000 (16:52 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 23 Sep 2016 16:03:56 +0000 (19:03 +0300)
commit4355c1abcaedd64a18d627284a3b7e54acb00714
treebf94f26ae2d93b310bac84496bd550c46fe0ccb0
parent412e0e81b17488e228b4f8451df6a4af26064bb4
virtio: handle virtqueue_num_heads() errors

If the avail ring index is bogus virtqueue_num_heads() must return
-EINVAL.

The only caller is virtqueue_get_avail_bytes().  Return saying no bytes
are available when virtqueue_num_heads() fails.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/virtio/virtio.c