]> Git Repo - qemu.git/commitdiff
virtio-ccw: validate the number of queues against bus limitation
authorJason Wang <[email protected]>
Fri, 29 May 2015 06:15:28 +0000 (14:15 +0800)
committerMichael S. Tsirkin <[email protected]>
Sun, 31 May 2015 14:45:38 +0000 (16:45 +0200)
Cc: Cornelia Huck <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Alexander Graf <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/s390x/virtio-ccw.c

index 60d60d6186f16735ad84b57960cbdd7f3fd71138..ef90feddeaa02bb4403eaad5e9581a6b187a6437 100644 (file)
@@ -1381,7 +1381,16 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
 static void virtio_ccw_device_plugged(DeviceState *d, Error **errp)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
+    VirtIODevice *vdev = virtio_bus_get_device(&dev->bus);
     SubchDev *sch = dev->sch;
+    int n = virtio_get_num_queues(vdev);
+
+    if (virtio_get_num_queues(vdev) > VIRTIO_CCW_QUEUE_MAX) {
+        error_setg(errp, "The nubmer of virtqueues %d "
+                   "exceeds ccw limit %d", n,
+                   VIRTIO_CCW_QUEUE_MAX);
+        return;
+    }
 
     sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus);
 
This page took 0.028019 seconds and 4 git commands to generate.