summary refs log tree commit diff stats
path: root/hw/net/virtio-net.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2017-05-08 17:08:12 -0300
committerMichael S. Tsirkin <mst@redhat.com>2017-05-10 22:04:23 +0300
commitef0e8fc768a561dd13a86420b3268f6f3d5d0621 (patch)
treefcaf07919181da1a98c28b4af0c4ecb3ab43a696 /hw/net/virtio-net.c
parent465238d9f873a6251223db1669aa4766822a8783 (diff)
downloadfocaccia-qemu-ef0e8fc768a561dd13a86420b3268f6f3d5d0621.tar.gz
focaccia-qemu-ef0e8fc768a561dd13a86420b3268f6f3d5d0621.zip
iommu: Don't crash if machine is not PC_MACHINE
Currently it's possible to crash QEMU using "-device *-iommu" and
"-machine none":

  $ qemu-system-x86_64 -machine none -device amd-iommu
  qemu/hw/i386/amd_iommu.c:1140:amdvi_realize: Object 0x55627dafbc90 is not an instance of type generic-pc-machine
  Aborted (core dumped)
  $ qemu-system-x86_64 -machine none -device intel-iommu
  qemu/hw/i386/intel_iommu.c:2972:vtd_realize: Object 0x56292ec0bc90 is not an instance of type generic-pc-machine
  Aborted (core dumped)

Fix amd-iommu and intel-iommu to ensure the current machine is really a
TYPE_PC_MACHINE instance at their realize methods.

Resulting error messages:

  $ qemu-system-x86_64 -machine none -device amd-iommu
  qemu-system-x86_64: -device amd-iommu: Machine-type 'none' not supported by amd-iommu
  $ qemu-system-x86_64 -machine none -device intel-iommu
  qemu-system-x86_64: -device intel-iommu: Machine-type 'none' not supported by intel-iommu

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
0 files changed, 0 insertions, 0 deletions