linux/virt/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
..
coalesced_mmio.c
coalesced_mmio.h
ioapic.c KVM: Export ioapic_get_delivery_bitmask 2008-12-31 16:55:01 +02:00
ioapic.h KVM: Export ioapic_get_delivery_bitmask 2008-12-31 16:55:01 +02:00
iodev.h
iommu.c kvm/iommu: fix compile warning 2009-01-03 16:37:53 +01:00
irq_comm.c KVM: add KVM_USERSPACE_IRQ_SOURCE_ID assertions 2008-12-31 16:55:07 +02:00
kvm_main.c KVM: Fix racy in kvm_free_assigned_irq 2009-02-15 02:47:36 +02:00
kvm_trace.c KVM: Prevent trace call into unloaded module text 2008-12-31 16:55:04 +02:00