]> xenbits.xensource.com Git - qemu-upstream-4.5-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:50:05 +0000 (10:50 -0700)
commit835c204f1196ab8f5213a9dc5299ed76e748cdca
tree7ddce44c9ea60710616bab8e62a4739cd16fc920
parent5e40cec825a2582d8a91119c485f5130cc2648e9
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