From patchwork Thu Feb 5 16:05:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carsten Otte X-Patchwork-Id: 5661 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n15G6IjU028025 for ; Thu, 5 Feb 2009 16:06:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758586AbZBEQGQ (ORCPT ); Thu, 5 Feb 2009 11:06:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758564AbZBEQGP (ORCPT ); Thu, 5 Feb 2009 11:06:15 -0500 Received: from mtagate7.uk.ibm.com ([195.212.29.140]:38550 "EHLO mtagate7.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758205AbZBEQGO (ORCPT ); Thu, 5 Feb 2009 11:06:14 -0500 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate7.uk.ibm.com (8.13.8/8.13.8) with ESMTP id n15G54D5204768 for ; Thu, 5 Feb 2009 16:05:04 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id n15G54nN2789482 for ; Thu, 5 Feb 2009 16:05:04 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n15G53cB030749 for ; Thu, 5 Feb 2009 16:05:03 GMT Received: from cotte.boeblingen.de.ibm.com (dyn-9-152-212-72.boeblingen.de.ibm.com [9.152.212.72]) by d06av02.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n15G52SA030734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 5 Feb 2009 16:05:03 GMT Date: Thu, 5 Feb 2009 17:05:01 +0100 From: Carsten Otte To: Avi Kivity Cc: KVM mailing list Subject: [PATCH 3/3] kvm common: verify that cpu slot is available when creating new vcpu Message-ID: <20090205170501.2a964172@cotte.boeblingen.de.ibm.com> In-Reply-To: <20090205170124.46fee96b@cotte.boeblingen.de.ibm.com> References: <20090205170124.46fee96b@cotte.boeblingen.de.ibm.com> Organization: IBM Deutschland Research & Development GmbH / Vorsitzender des Aufsichtsrats: Martin =?UTF-8?B?SmV0dGVyLEdlc2Now6RmdHNmw7xocnVuZzo=?= Herbert Kircher, Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= / Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Signed-off-by: Carsten Otte --- 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 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[i]) + return -EEXIST; + vcpu = kvm_arch_vcpu_create(kvm, n); if (IS_ERR(vcpu)) return PTR_ERR(vcpu);