virtio-net: validate backend queue numbers against bus limitation
commit7e0e736ecdfeac6d3517513d3a702304e4f6cf59
authorJason Wang <jasowang@redhat.com>
Fri, 20 Mar 2015 06:07:50 +0000 (20 14:07 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Mar 2015 12:39:25 +0000 (25 13:39 +0100)
treea3afabb60e43593737ee49276d8019384da7b5aa
parent7976a6d23151c780474bdac106f3cf1343a2d6ca
virtio-net: validate backend queue numbers against bus limitation

We don't validate the backend queue numbers against bus limitation,
this will easily crash qemu if it exceeds the limitation which will
hit the abort() in virtio_del_queue(). An example is trying to
starting a virtio-net device with 256 queues. E.g:

./qemu-system-x86_64 -netdev tap,id=hn0,queues=256 -device
virtio-net-pci,netdev=hn0

Fixing this by doing the validation and fail early.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/net/virtio-net.c