diff mbox

[3/3,v2] kvm common: verify that cpu slot is available when creating new vcpu

Message ID 20090205174059.2dedf38a@cotte.boeblingen.de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Carsten Otte Feb. 5, 2009, 4:40 p.m. UTC
KVM common code should'nt try to create the same virtual cpu twice.
In case of s390, it crashes badly in kvm_arch_vcpu_create.

Reported-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
---
 virt/kvm/kvm_main.c |    3 +++
 1 file changed, 3 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: kvm/virt/kvm/kvm_main.c
===================================================================
--- kvm.orig/virt/kvm/kvm_main.c
+++ kvm/virt/kvm/kvm_main.c
@@ -1605,6 +1605,9 @@  static int kvm_vm_ioctl_create_vcpu(stru
 	if (!valid_vcpu(n))
 		return -EINVAL;
 
+	if (kvm->vcpus[n])
+		return -EEXIST;
+
 	vcpu = kvm_arch_vcpu_create(kvm, n);
 	if (IS_ERR(vcpu))
 		return PTR_ERR(vcpu);