]> Git Repo - qemu.git/commitdiff
virtio-crypto-pci: add check for cryptodev object
authorGonglei <[email protected]>
Thu, 22 Dec 2016 03:12:40 +0000 (11:12 +0800)
committerMichael S. Tsirkin <[email protected]>
Tue, 10 Jan 2017 05:02:52 +0000 (07:02 +0200)
We must assure each virtio crypto pci device has
an vaild cryptodev backend object.

Signed-off-by: Gonglei <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/virtio/virtio-crypto-pci.c

index a1b09064c07fe46915eede4d84fe045506ac2dfc..14bd12c6341eef805337f2295f3a33af771c8822 100644 (file)
@@ -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);
This page took 0.027107 seconds and 4 git commands to generate.