]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Protect device ops->create and list_add with kvm->lock
authorChristoffer Dall <christoffer.dall@linaro.org>
Tue, 9 Aug 2016 17:13:01 +0000 (19:13 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Fri, 12 Aug 2016 10:01:27 +0000 (12:01 +0200)
commit0ba448b9dc4ccdc4fa71d4c47b7c259888321809
tree2ce115dec973b4383b64a33a999b7396e9b8f8e8
parentb7472e91ab34e13927a2594f8d60d043f76160eb
KVM: Protect device ops->create and list_add with kvm->lock

KVM devices were manipulating list data structures without any form of
synchronization, and some implementations of the create operations also
suffered from a lack of synchronization.

Now when we've split the xics create operation into create and init, we
can hold the kvm->lock mutex while calling the create operation and when
manipulating the devices list.

The error path in the generic code gets slightly ugly because we have to
take the mutex again and delete the device from the list, but holding
the mutex during anon_inode_getfd or releasing/locking the mutex in the
common non-error path seemed wrong.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/arm/kvm/arm.c
arch/powerpc/kvm/book3s_xics.c
include/linux/kvm_host.h
virt/kvm/arm/vgic/vgic-init.c
virt/kvm/kvm_main.c