diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2014-12-09 13:33:45 (GMT) |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-12-13 13:17:10 (GMT) |
commit | 716139df2517fbc3f2306dbe8eba0fa88dca0189 (patch) | |
tree | 5c0a965f16c129f7b31c7404e78b908a184cd4e9 /arch/arm/kvm/arm.c | |
parent | 1f57be289571d514b9412da2af25a64a81b8dd89 (diff) | |
download | linux-716139df2517fbc3f2306dbe8eba0fa88dca0189.tar.xz |
arm/arm64: KVM: Don't allow creating VCPUs after vgic_initialized
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 <marc.zyngier@arm.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/kvm/arm.c')
-rw-r--r-- | arch/arm/kvm/arm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index c5a05f2..66f37c4 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -213,6 +213,11 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) 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; |