Skip to contentSkip to conversation

x86/ioapic: Avoid trying to access the -1th ioapic.

PATCH In review Andrew Cooper 2 participants 2 messages Sep 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ioapic: Avoid trying to access the -1th ioapic.

Discovered by Coverity, CID 1055743

Depending on the contents of the mp_irqs/mp_ioapics from the MP table, find_isa_irq_apic() might return -1, at which point calling ioapic_read_entry() with it is bad.

In addition to bailing if pin is -1, bail if apic is -1.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
---
 xen/arch/x86/io_apic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/io_apic.c +1 -1
index 048c61c..5512cd5 100644
@@ -1828,7 +1828,7 @@ static void __init unlock_ExtINT_logic(void)
 
     pin = find_isa_irq_pin(8, mp_INT);
     apic = find_isa_irq_apic(8, mp_INT);
-    if (pin == -1)
+    if ( pin == -1 || apic == -1 )
         return;
 
     entry0 = ioapic_read_entry(apic, pin, 0);
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Andrew Cooper

Discovered by Coverity, CID 1055743

Depending on the contents of the mp_irqs/mp_ioapics from the MP table, find_isa_irq_apic() might return -1, at which point calling ioapic_read_entry() with it is bad.

In addition to bailing if pin is -1, bail if apic is -1.

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
Quoted 17 lines
---
 xen/arch/x86/io_apic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/io_apic.c +1 -1
index 048c61c..5512cd5 100644
@@ -1828,7 +1828,7 @@ static void __init unlock_ExtINT_logic(void)
 
     pin = find_isa_irq_pin(8, mp_INT);
     apic = find_isa_irq_apic(8, mp_INT);
-    if (pin == -1)
+    if ( pin == -1 || apic == -1 )
         return;
 
     entry0 = ioapic_read_entry(apic, pin, 0);