1
linux/arch/x86/kvm
Sheng Yang ba4cef31d5 KVM: Fix racy in kvm_free_assigned_irq
In the past, kvm_get_kvm() and kvm_put_kvm() was called in assigned device irq
handler and interrupt_work, in order to prevent cancel_work_sync() in
kvm_free_assigned_irq got a illegal state when waiting for interrupt_work done.
But it's tricky and still got two problems:

1. A bug ignored two conditions that cancel_work_sync() would return true result
in a additional kvm_put_kvm().

2. If interrupt type is MSI, we would got a window between cancel_work_sync()
and free_irq(), which interrupt would be injected again...

This patch discard the reference count used for irq handler and interrupt_work,
and ensure the legal state by moving the free function at the very beginning of
kvm_destroy_vm(). And the patch fix the second bug by disable irq before
cancel_work_sync(), which may result in nested disable of irq but OK for we are
going to free it.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2009-02-15 02:47:36 +02:00
..
i8254.c KVM: x86: Optimize NMI watchdog delivery 2008-12-31 16:51:47 +02:00
i8254.h KVM: Fix guest shared interrupt with in-kernel irqchip 2008-10-28 14:21:34 +02:00
i8259.c KVM: Add locking to virtual i8259 interrupt controller 2008-12-31 16:55:48 +02:00
irq.c KVM: Separate irq ack notification out of arch/x86/kvm/irq.c 2008-10-15 14:25:35 +02:00
irq.h KVM: Add locking to virtual i8259 interrupt controller 2008-12-31 16:55:48 +02:00
Kconfig KVM: Require the PCI subsystem 2008-11-11 20:56:13 +02:00
kvm_cache_regs.h
kvm_svm.h KVM: SVM: move svm.h to include/asm 2008-12-31 16:52:28 +02:00
lapic.c KVM: x86: Optimize NMI watchdog delivery 2008-12-31 16:51:47 +02:00
lapic.h
Makefile KVM: change KVM to use IOMMU API 2009-01-03 14:11:07 +01:00
mmu.c KVM: MMU: handle large host sptes on invlpg/resync 2008-12-31 16:55:49 +02:00
mmu.h
paging_tmpl.h KVM: MMU: handle large host sptes on invlpg/resync 2008-12-31 16:55:49 +02:00
svm.c KVM: SVM: move svm_hardware_disable() code to asm/virtext.h 2008-12-31 16:52:30 +02:00
tss.h
vmx.c KVM: x86: Rework user space NMI injection as KVM_CAP_USER_NMI 2008-12-31 16:55:47 +02:00
x86_emulate.c KVM: x86 emulator: Fix handling of VMMCALL instruction 2008-12-31 16:55:43 +02:00
x86.c KVM: Fix racy in kvm_free_assigned_irq 2009-02-15 02:47:36 +02:00
x86.h