Skip to content

Commit

Permalink
KVM: check injected pic irq within valid pic irqs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben-Ami Yassour authored and Avi Kivity committed Jul 20, 2008
1 parent 19fdfa0 commit c65bbfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/x86/kvm/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/*
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kvm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "ioapic.h"
#include "lapic.h"

#define PIC_NUM_PINS 16

struct kvm;
struct kvm_vcpu;

Expand Down

0 comments on commit c65bbfa

Please sign in to comment.