virtio: avoid buffer overrun on incoming migration
commit4b53c2c72cb5541cf394033b528a6fe2a86c0ac1
authorMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Apr 2014 16:51:46 +0000 (3 19:51 +0300)
committerJuan Quintela <quintela@redhat.com>
Mon, 5 May 2014 20:15:02 +0000 (5 22:15 +0200)
tree83beef3b93918cf372cc3c948398d59e18dea64a
parentd2ef4b61fe6d33d2a5dcf100a9b9440de341ad62
virtio: avoid buffer overrun on incoming migration

CVE-2013-6399

vdev->queue_sel is read from the wire, and later used in the
emulation code as an index into vdev->vq[]. If the value of
vdev->queue_sel exceeds the length of vdev->vq[], currently
allocated to be VIRTIO_PCI_QUEUE_MAX elements, subsequent PIO
operations such as VIRTIO_PCI_QUEUE_PFN can be used to overrun
the buffer with arbitrary data originating from the source.

Fix this by failing migration if the value from the wire exceeds
VIRTIO_PCI_QUEUE_MAX.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
hw/virtio/virtio.c