mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ben-Ami Yassour <benami@il.ibm.com>
Subject: [PATCH 14/19] KVM: check injected pic irq within valid pic irqs
Date: Tue, 15 Jul 2008 15:12:33 +0300	[thread overview]
Message-ID: <1216123958-10717-15-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1216123958-10717-1-git-send-email-avi@qumranet.com>

From: Ben-Ami Yassour <benami@il.ibm.com>

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 |    6 ++++--
 arch/x86/kvm/irq.h   |    2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 5857f59..c31164e 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -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);
+	}
 }
 
 /*
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 2a15be2..7ca47cb 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -30,6 +30,8 @@
 #include "ioapic.h"
 #include "lapic.h"
 
+#define PIC_NUM_PINS 16
+
 struct kvm;
 struct kvm_vcpu;
 
-- 
1.5.6.1


  parent reply	other threads:[~2008-07-15 12:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 12:12 [PATCH 00/19] KVM Updates for the 2.6.27 (supplemental) Avi Kivity
2008-07-15 12:12 ` [PATCH 01/19] KVM: VMX: Fix a wrong usage of vmcs_config Avi Kivity
2008-07-15 12:12 ` [PATCH 02/19] KVM: VMX: Fake emulate Intel perfctr MSRs Avi Kivity
2008-07-15 12:12 ` [PATCH 03/19] KVM: move slots_lock acquision down to vapic_exit Avi Kivity
2008-07-15 12:12 ` [PATCH 04/19] KVM: s390: dont allocate dirty bitmap Avi Kivity
2008-07-15 12:12 ` [PATCH 05/19] KVM: Fix memory leak on guest exit Avi Kivity
2008-07-15 12:12 ` [PATCH 06/19] KVM: s390: Set guest storage limit and offset to sane values Avi Kivity
2008-07-15 12:12 ` [PATCH 07/19] KVM: s390: rename private structures Avi Kivity
2008-07-15 12:12 ` [PATCH 08/19] KVM: SVM: fix suspend/resume support Avi Kivity
2008-07-15 12:12 ` [PATCH 09/19] x86: KVM guest: make kvm_smp_prepare_boot_cpu() static Avi Kivity
2008-07-15 12:12 ` [PATCH 10/19] KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held Avi Kivity
2008-07-15 12:12 ` [PATCH 11/19] KVM: VMX: Add ept_sync_context in flush_tlb Avi Kivity
2008-07-15 12:12 ` [PATCH 12/19] KVM: Apply the kernel sigmask to vcpus blocked due to being uninitialized Avi Kivity
2008-07-15 12:12 ` [PATCH 13/19] KVM: x86 emulator: Fix HLT instruction Avi Kivity
2008-07-15 12:12 ` Avi Kivity [this message]
2008-07-15 12:12 ` [PATCH 15/19] KVM: Prefix some x86 low level function with kvm_, to avoid namespace issues Avi Kivity
2008-07-15 12:12 ` [PATCH 16/19] KVM: MMU: nuke shadowed pgtable pages and ptes on memslot destruction Avi Kivity
2008-07-15 12:12 ` [PATCH 17/19] KVM: MMU: improve invalid shadow root page handling Avi Kivity
2008-07-15 12:12 ` [PATCH 18/19] KVM: x86 emulator: emulate clflush Avi Kivity
2008-07-15 12:12 ` [PATCH 19/19] KVM: MMU: Fix potential race setting upper shadow ptes on nonpae hosts Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1216123958-10717-15-git-send-email-avi@qumranet.com \
    --to=avi@qumranet.com \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®