Commit c65bbfa1 authored by Ben-Ami Yassour's avatar Ben-Ami Yassour Committed by Avi Kivity

KVM: check injected pic irq within valid pic irqs

Check that an injected pic irq is between 0 and 15.
Signed-off-by: default avatarBen-Ami Yassour <benami@il.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 19fdfa0d
...@@ -130,8 +130,10 @@ void kvm_pic_set_irq(void *opaque, int irq, int level) ...@@ -130,8 +130,10 @@ void kvm_pic_set_irq(void *opaque, int irq, int level)
{ {
struct kvm_pic *s = opaque; struct kvm_pic *s = opaque;
pic_set_irq1(&s->pics[irq >> 3], irq & 7, level); if (irq >= 0 && irq < PIC_NUM_PINS) {
pic_update_irq(s); pic_set_irq1(&s->pics[irq >> 3], irq & 7, level);
pic_update_irq(s);
}
} }
/* /*
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "ioapic.h" #include "ioapic.h"
#include "lapic.h" #include "lapic.h"
#define PIC_NUM_PINS 16
struct kvm; struct kvm;
struct kvm_vcpu; struct kvm_vcpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment