]> err.no Git - linux-2.6/commitdiff
KVM: check injected pic irq within valid pic irqs
authorBen-Ami Yassour <benami@il.ibm.com>
Sun, 6 Jul 2008 14:15:07 +0000 (17:15 +0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 20 Jul 2008 09:42:39 +0000 (12:42 +0300)
Check that an injected pic irq is between 0 and 15.

Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/i8259.c
arch/x86/kvm/irq.h

index 5857f59ad4aac7e0d90b6235fcd65bdd41b26205..c31164e8aa46c498643b9fa953df3920d598a1d3 100644 (file)
@@ -130,8 +130,10 @@ void kvm_pic_set_irq(void *opaque, int irq, int level)
 {
        struct kvm_pic *s = opaque;
 
-       pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
-       pic_update_irq(s);
+       if (irq >= 0 && irq < PIC_NUM_PINS) {
+               pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
+               pic_update_irq(s);
+       }
 }
 
 /*
index 2a15be2275c0e1d84eb3b0ce1c8a24d1e1986072..7ca47cbb48bb3c2239a2ebb13975d43f5f9bac4b 100644 (file)
@@ -30,6 +30,8 @@
 #include "ioapic.h"
 #include "lapic.h"
 
+#define PIC_NUM_PINS 16
+
 struct kvm;
 struct kvm_vcpu;