]> xenbits.xensource.com Git - qemu-upstream-4.6-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:42:12 +0000 (10:42 -0700)
commitebfc90b51d09e0a3330a4702bb23223cf088eabd
treed776e6c942e80389ba799ee0021a054f96ac0b7b
parent7a88f1257d5261a7bee98facdb97f50d5553060e
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