]> xenbits.xensource.com Git - xen.git/commitdiff
AMD IOMMU: add missing check
authorJan Beulich <jbeulich@suse.com>
Fri, 6 Sep 2013 12:07:54 +0000 (14:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Sep 2013 12:07:54 +0000 (14:07 +0200)
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

xen/drivers/passthrough/amd/iommu_acpi.c

index 6a2cbb6190c1c909c8af7a61042cc9c0d7e51f38..330e74f5f9ed52c40d8078b60b12426e8e79318a 100644 (file)
@@ -671,6 +671,13 @@ static u16 __init parse_ivhd_device_special(
             if ( IO_APIC_ID(apic) != special->handle )
                 continue;
 
+            if ( special->handle >= ARRAY_SIZE(ioapic_sbdf) )
+            {
+                printk(XENLOG_ERR "IVHD Error: IO-APIC %#x entry beyond bounds\n",
+                       special->handle);
+                return 0;
+            }
+
             if ( ioapic_sbdf[special->handle].pin_setup )
             {
                 if ( ioapic_sbdf[special->handle].bdf == bdf &&