aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-09-06 15:43:07 +0200
committerJan Beulich <jbeulich@suse.com>2013-09-06 15:43:07 +0200
commit560691065225cc060236ae1c2ba7e3ff8349c485 (patch)
tree432b289d2c33eb68c4a4466b07a873cb0c7505d9
parent47477f63bb2ee742a83633ff8d303188f3828672 (diff)
downloadxen-560691065225cc060236ae1c2ba7e3ff8349c485.tar.gz
xen-560691065225cc060236ae1c2ba7e3ff8349c485.tar.bz2
xen-560691065225cc060236ae1c2ba7e3ff8349c485.zip
AMD IOMMU: add missing check
We shouldn't accept IVHD tables specifying IO-APIC IDs beyond the limit we support (MAX_IO_APICS, currently 128). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Suravee Suthikulpanit <suravee.suthikulapanit@amd.com> master commit: 3785d30efe8264b899499e0883b10cc434bd0959 master date: 2013-08-29 09:31:37 +0200
-rw-r--r--xen/drivers/passthrough/amd/iommu_acpi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 73524384c2..0aeeb30737 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -677,6 +677,13 @@ static u16 __init parse_ivhd_device_special(
if ( IO_APIC_ID(apic) != ivhd_device->special.handle )
continue;
+ if ( ivhd_device->special.handle >= MAX_IO_APICS )
+ {
+ printk(XENLOG_ERR "IVHD Error: IO-APIC %#x entry beyond bounds\n",
+ ivhd_device->special.handle);
+ return 0;
+ }
+
if ( ioapic_bdf[ivhd_device->special.handle].pin_setup )
{
if ( ioapic_bdf[ivhd_device->special.handle].bdf == bdf )