aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kvm/irq.h
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-10-29 13:44:15 -0200
committerAvi Kivity <avi@redhat.com>2009-12-03 09:32:23 +0200
commit3ddea128ad75bd33e88780fe44f44c3717369b98 (patch)
treedbf54798bda23cb8c105c6fc3926d30bae3c6321 /arch/x86/kvm/irq.h
parent92c0d900159a4fa582e1c8ebcc1c4a8020defff5 (diff)
KVM: x86: disallow multiple KVM_CREATE_IRQCHIP
Otherwise kvm will leak memory on multiple KVM_CREATE_IRQCHIP. Also serialize multiple accesses with kvm->lock. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/irq.h')
-rw-r--r--arch/x86/kvm/irq.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index c025a2362aa..be399e207d5 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -86,7 +86,11 @@ static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
static inline int irqchip_in_kernel(struct kvm *kvm)
{
- return pic_irqchip(kvm) != NULL;
+ int ret;
+
+ ret = (pic_irqchip(kvm) != NULL);
+ smp_rmb();
+ return ret;
}
void kvm_pic_reset(struct kvm_kpic_state *s);