]> git.karo-electronics.de Git - linux-beck.git/commit
KVM: s390: fix SCA related races and double use
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Mon, 12 Oct 2015 14:27:23 +0000 (16:27 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 30 Nov 2015 11:47:09 +0000 (12:47 +0100)
commit2550882449299fd55c8214529cc0777b789db0f7
treecda96a382c91c236794ffa0ad98e283553c0634f
parent5f3fe620a56f2f5c79e89522107f2476a45ed6ce
KVM: s390: fix SCA related races and double use

If something goes wrong in kvm_arch_vcpu_create, the VCPU has already
been added to the sca but will never be removed. Trying to create VCPUs
with duplicate ids (e.g. after a failed attempt) is problematic.

Also, when creating multiple VCPUs in parallel, we could theoretically
forget to set the correct SCA when the switch to ESCA happens just
before the VCPU is registered.

Let's add the VCPU to the SCA in kvm_arch_vcpu_postcreate, where we can
be sure that no duplicate VCPU with the same id is around and the VCPU
has already been registered at the VM. We also have to make sure to update
ECB at that point.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/kvm-s390.c