提交 5b456438 编写于 作者: C Cole Robinson 提交者: Anthony Liguori

virtio-rng: Fix crash with non-default backend

'default_backend' isn't always set, but 'rng' is, so use that.

$ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
Segmentation fault (core dumped)

Regressed with virtio refactoring in 59ccd20a

CC: qemu-stable@nongnu.org
Signed-off-by: NCole Robinson <crobinso@redhat.com>
Acked-by: NAmit Shah <amit.shah@redhat.com>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
Tested-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
Message-id: bf4505014a0a941dbd3c62068f3cf2c496b69e6a.1370023944.git.crobinso@redhat.com
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 afd59989
...@@ -300,7 +300,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev) ...@@ -300,7 +300,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)
} }
object_property_set_link(OBJECT(dev), object_property_set_link(OBJECT(dev),
OBJECT(dev->vdev.conf.default_backend), "rng", OBJECT(dev->vdev.conf.rng), "rng",
NULL); NULL);
return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev)); return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
......
...@@ -744,7 +744,7 @@ static int virtio_ccw_rng_init(VirtioCcwDevice *ccw_dev) ...@@ -744,7 +744,7 @@ static int virtio_ccw_rng_init(VirtioCcwDevice *ccw_dev)
} }
object_property_set_link(OBJECT(dev), object_property_set_link(OBJECT(dev),
OBJECT(dev->vdev.conf.default_backend), "rng", OBJECT(dev->vdev.conf.rng), "rng",
NULL); NULL);
return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev)); return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
......
...@@ -1455,7 +1455,7 @@ static int virtio_rng_pci_init(VirtIOPCIProxy *vpci_dev) ...@@ -1455,7 +1455,7 @@ static int virtio_rng_pci_init(VirtIOPCIProxy *vpci_dev)
} }
object_property_set_link(OBJECT(vrng), object_property_set_link(OBJECT(vrng),
OBJECT(vrng->vdev.conf.default_backend), "rng", OBJECT(vrng->vdev.conf.rng), "rng",
NULL); NULL);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册