diff options
author | Gonglei <arei.gonglei@huawei.com> | 2016-12-22 11:12:40 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-01-10 07:02:52 +0200 |
commit | 305f5131ac30b4a03e698bae0976f4cd24bb0a86 (patch) | |
tree | 9e3f3b4a8328a06c214efd49b64d8d1805a32035 | |
parent | 6138dbda5a4bfa6c724fd04b9225181d3a3c85a7 (diff) | |
download | qemu-305f5131ac30b4a03e698bae0976f4cd24bb0a86.zip |
virtio-crypto-pci: add check for cryptodev object
We must assure each virtio crypto pci device has
an vaild cryptodev backend object.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | hw/virtio/virtio-crypto-pci.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c index a1b09064c0..14bd12c634 100644 --- a/hw/virtio/virtio-crypto-pci.c +++ b/hw/virtio/virtio-crypto-pci.c @@ -31,6 +31,11 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VirtIOCryptoPCI *vcrypto = VIRTIO_CRYPTO_PCI(vpci_dev); DeviceState *vdev = DEVICE(&vcrypto->vdev); + if (vcrypto->vdev.conf.cryptodev == NULL) { + error_setg(errp, "'cryptodev' parameter expects a valid object"); + return; + } + qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); virtio_pci_force_virtio_1(vpci_dev); object_property_set_bool(OBJECT(vdev), true, "realized", errp); |