提交 a0c167a1 编写于 作者: M Mohammed Gamal 提交者: Michael S. Tsirkin

x86_iommu: check if machine has PCI bus

Starting qemu with
qemu-system-x86_64 -S -M isapc -device {amd|intel}-iommu
leads to a segfault. The code assume PCI bus is present and
tries to access the bus structure without checking.

Since Intel VT-d and AMDVI should only work with PCI, add a
check for PCI bus and return error if not present.
Reviewed-by: NPeter Xu <peterx@redhat.com>
Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NMohammed Gamal <mgamal@redhat.com>
Reviewed-by: NThomas Huth <thuth@redhat.com>
上级 29396ed9
......@@ -88,7 +88,7 @@ static void x86_iommu_realize(DeviceState *dev, Error **errp)
PC_MACHINE(object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE));
QLIST_INIT(&x86_iommu->iec_notifiers);
if (!pcms) {
if (!pcms || !pcms->bus) {
error_setg(errp, "Machine-type '%s' not supported by IOMMU",
mc->name);
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册