[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] virtio-scsi: Report error if num_queues is 0 or
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] virtio-scsi: Report error if num_queues is 0 or too large |
Date: |
Tue, 26 Aug 2014 13:20:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
Il 26/08/2014 08:30, Fam Zheng ha scritto:
> 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>
> ---
> 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;
>
Thanks, applying to scsi-next.
Paolo