diff options
author | Sheng Yang <sheng@linux.intel.com> | 2009-12-14 21:28:07 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2009-12-27 10:36:31 -0500 |
commit | fae3a3536a6fecedebd49fa847f810e599bfb132 (patch) | |
tree | 18b555c3f6bcc6735fd7a90db2c398a35e29c84e /virt/kvm/kvm_main.c | |
parent | fb341f572d26e0786167cd96b90cc4febed830cf (diff) |
KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()
One possible order is:
KVM_CREATE_IRQCHIP ioctl(took kvm->lock) -> kvm_iobus_register_dev() ->
down_write(kvm->slots_lock).
The other one is in kvm_vm_ioctl_assign_device(), which take kvm->slots_lock
first, then kvm->lock.
Update the comment of lock order as well.
Observe it due to kernel locking debug warnings.
Cc: stable@kernel.org
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b5af88167613..7db071ba466c 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -64,7 +64,7 @@ MODULE_LICENSE("GPL"); | |||
64 | /* | 64 | /* |
65 | * Ordering of locks: | 65 | * Ordering of locks: |
66 | * | 66 | * |
67 | * kvm->slots_lock --> kvm->lock --> kvm->irq_lock | 67 | * kvm->lock --> kvm->slots_lock --> kvm->irq_lock |
68 | */ | 68 | */ |
69 | 69 | ||
70 | DEFINE_SPINLOCK(kvm_lock); | 70 | DEFINE_SPINLOCK(kvm_lock); |