[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 23/27] spapr_vty: lookup should only return valid VTY
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 23/27] spapr_vty: lookup should only return valid VTY objects |
Date: |
Thu, 2 Jul 2015 16:23:24 +1000 |
If a guest passes the reg property of a valid VIO object that is not a VTY
to either H_GET_TERM_CHAR or H_PUT_TERM_CHAR, QEMU hits a dynamic cast
assertion and aborts.
PAPR+ says "Hypervisor checks the termno parameter for validity against the
Vterm IOA unit addresses assigned to the partition, else return H_Parameter."
This patch adds a type check to ensure vty_lookup() either returns a pointer
to a valid VTY object or NULL. H_GET_TERM_CHAR and H_PUT_TERM_CHAR will
now return H_PARAMETER to the guest instead of crashing.
The patch has no effect on the reg == 0 hack used to implement the RTAS call
display-character.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/char/spapr_vty.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c
index 1d53035..2d532af 100644
--- a/hw/char/spapr_vty.c
+++ b/hw/char/spapr_vty.c
@@ -228,6 +228,10 @@ VIOsPAPRDevice *vty_lookup(sPAPRMachineState *spapr,
target_ulong reg)
return spapr_vty_get_default(spapr->vio_bus);
}
+ if (!object_dynamic_cast(OBJECT(sdev), TYPE_VIO_SPAPR_VTY_DEVICE)) {
+ return NULL;
+ }
+
return sdev;
}
--
2.4.3
- [Qemu-ppc] [PATCH 01/27] spapr: ensure we have at least one XICS server, (continued)
- [Qemu-ppc] [PATCH 01/27] spapr: ensure we have at least one XICS server, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 07/27] spapr_pci: encode missing 64-bit memory address space, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 04/27] spapr: Remove obsolete ram_limit field from sPAPRMachineState, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 06/27] spapr: Add sPAPRMachineClass, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 09/27] spapr_pci: set device node unit address as hex, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 26/27] sPAPR: Reenable EEH functionality on reboot, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 25/27] sPAPR: Don't enable EEH on emulated PCI devices, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 17/27] spapr: Consolidate cpu init code into a routine, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 13/27] spapr: Consider max_cpus during xics initialization, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 12/27] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)", David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 23/27] spapr_vty: lookup should only return valid VTY objects,
David Gibson <=
- [Qemu-ppc] [PATCH 15/27] cpus: Add a macro to walk CPUs in reverse, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 22/27] spapr_pci: drop redundant args in spapr_[populate, create]_pci_child_dt, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 05/27] spapr: Remove obsolete entry_point field from sPAPRMachineState, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 10/27] spapr_iommu: drop erroneous check in h_put_tce_indirect(), David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 19/27] xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 11/27] spapr_iommu: translate sPAPRTCEAccess to IOMMUAccessFlags, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 14/27] spapr: Support ibm, lrdr-capacity device tree property, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 08/27] spapr_pci: encode class code including Prog IF register, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 21/27] spapr_pci: populate ibm,loc-code, David Gibson, 2015/07/02
- [Qemu-ppc] [PATCH 27/27] sPAPR: Clear stale MSIx table during EEH reset, David Gibson, 2015/07/02