[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/8] virtio-scsi: Report error if num_queues is 0 or
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 5/8] virtio-scsi: Report error if num_queues is 0 or too large |
Date: |
Thu, 28 Aug 2014 16:13:22 +0200 |
From: Fam Zheng <address@hidden>
No cmd vq surprises guest (Linux panics in virtscsi_probe), too many
queues abort qemu (in the following virtio_add_queue).
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/virtio-scsi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 2dd9255..86aba88 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -699,6 +699,12 @@ void virtio_scsi_common_realize(DeviceState *dev, Error
**errp,
virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI,
sizeof(VirtIOSCSIConfig));
+ if (s->conf.num_queues <= 0 || s->conf.num_queues > VIRTIO_PCI_QUEUE_MAX) {
+ error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
+ "must be a positive integer less than %d.",
+ s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
+ return;
+ }
s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
s->sense_size = VIRTIO_SCSI_SENSE_SIZE;
s->cdb_size = VIRTIO_SCSI_CDB_SIZE;
--
1.8.3.1
- [Qemu-devel] [PULL 0/8] SCSI and memory changes for 2014-08-28, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 3/8] block/iscsi: fix memory corruption on iscsi resize, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 1/8] block: Pass errp in blkconf_geometry, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 4/8] scsi-generic: remove superfluous DPRINTF avoid to break compiling, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 6/8] xen-hvm: Constify string, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 2/8] scsi-bus: Convert DeviceClass init to realize, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 7/8] xen: hvm: Abstract away memory region name ref, Paolo Bonzini, 2014/08/28
- [Qemu-devel] [PULL 5/8] virtio-scsi: Report error if num_queues is 0 or too large,
Paolo Bonzini <=
- [Qemu-devel] [PULL 8/8] memory: Lazy init name from QOM name as needed, Paolo Bonzini, 2014/08/28
- Re: [Qemu-devel] [PULL 0/8] SCSI and memory changes for 2014-08-28, Peter Maydell, 2014/08/28