]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commit
virtio: error out if guest exceeds virtqueue size
authorP J P <ppandit@redhat.com>
Mon, 25 Jul 2016 12:07:18 +0000 (17:37 +0530)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 27 Jul 2016 17:59:33 +0000 (10:59 -0700)
commite72488cdcf2208f2df334fa88c35b33e695fa93b
treeb2d470ebf46089a2b00240a328f6404b077ac4b9
parentca3d95113903ccffe52af3922bbf7bd14a9acc78
virtio: error out if guest exceeds virtqueue size

A broken or malicious guest can submit more requests than the virtqueue
size permits.

The guest can submit requests without bothering to wait for completion
and is therefore not bound by virtqueue size.  This requires reusing
vring descriptors in more than one request, which is incorrect but
possible.  Processing a request allocates a VirtQueueElement and
therefore causes unbounded memory allocation controlled by the guest.

Exit with an error if the guest provides more requests than the
virtqueue size permits.  This bounds memory allocation and makes the
buggy guest visible to the user.

upstream-commit-id: afd9096eb1882f23929f5b5c177898ed231bac66
Reported-by: Zhenhao Hong <zhenhaohong@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
hw/virtio/virtio.c