Skip to content

Commit

Permalink
virtio-crypto-pci: add check for cryptodev object
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gongleiarei authored and mstsirkin committed Jan 10, 2017
1 parent 6138dbd commit 305f513
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hw/virtio/virtio-crypto-pci.c
Expand Up @@ -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);
Expand Down

0 comments on commit 305f513

Please sign in to comment.