From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:44757 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754127AbbGASlt (ORCPT ); Wed, 1 Jul 2015 14:41:49 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Eric Auger , Christoffer Dall , Shannon Zhao Subject: [PATCH 3.14 34/34] arm/arm64: KVM: Dont allow creating VCPUs after vgic_initialized Date: Wed, 1 Jul 2015 11:40:41 -0700 Message-Id: <20150701183956.588517130@linuxfoundation.org> In-Reply-To: <20150701183955.306219425@linuxfoundation.org> References: <20150701183955.306219425@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: stable-owner@vger.kernel.org List-ID: 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christoffer Dall commit 716139df2517fbc3f2306dbe8eba0fa88dca0189 upstream. When the vgic initializes its internal state it does so based on the number of VCPUs available at the time. If we allow KVM to create more VCPUs after the VGIC has been initialized, we are likely to error out in unfortunate ways later, perform buffer overflows etc. Acked-by: Marc Zyngier Reviewed-by: Eric Auger Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Greg Kroah-Hartman --- arch/arm/kvm/arm.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -220,6 +220,11 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st int err; struct kvm_vcpu *vcpu; + if (irqchip_in_kernel(kvm) && vgic_initialized(kvm)) { + err = -EBUSY; + goto out; + } + vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL); if (!vcpu) { err = -ENOMEM;