Message ID | 20220519134204.5379-4-will@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: arm64: Base support for the pKVM hypervisor at EL2 | expand |
Hi, On Thu, May 19, 2022 at 02:40:38PM +0100, Will Deacon wrote: > If we fail to allocate the 'supported_cpus' cpumask in kvm_arch_init_vm() > then be sure to return -ENOMEM instead of success (0) on the failure > path. > > Signed-off-by: Will Deacon <will@kernel.org> > --- > arch/arm64/kvm/arm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 523bc934fe2f..775b52871b51 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -146,8 +146,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) > if (ret) > goto out_free_stage2_pgd; > > - if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) > + if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) { > + ret = -ENOMEM; > goto out_free_stage2_pgd; > + } > cpumask_copy(kvm->arch.supported_cpus, cpu_possible_mask); > > kvm_vgic_early_init(kvm); Thank you for the fix: Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> This can go in independent of the series. I can send it after rc1 if you prefer to focus on something else. Thanks, Alex
On Fri, May 20, 2022 at 04:55:51PM +0100, Alexandru Elisei wrote: > Hi, > > On Thu, May 19, 2022 at 02:40:38PM +0100, Will Deacon wrote: > > If we fail to allocate the 'supported_cpus' cpumask in kvm_arch_init_vm() > > then be sure to return -ENOMEM instead of success (0) on the failure > > path. > > > > Signed-off-by: Will Deacon <will@kernel.org> > > --- > > arch/arm64/kvm/arm.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > > index 523bc934fe2f..775b52871b51 100644 > > --- a/arch/arm64/kvm/arm.c > > +++ b/arch/arm64/kvm/arm.c > > @@ -146,8 +146,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) > > if (ret) > > goto out_free_stage2_pgd; > > > > - if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) > > + if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) { > > + ret = -ENOMEM; > > goto out_free_stage2_pgd; > > + } > > cpumask_copy(kvm->arch.supported_cpus, cpu_possible_mask); > > > > kvm_vgic_early_init(kvm); > > Thank you for the fix: > > Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com> Thanks! > This can go in independent of the series. I can send it after rc1 if you > prefer to focus on something else. Cheers, but I reckon I'll post the first 6 patches as their own series at -rc1 anyway. Will
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 523bc934fe2f..775b52871b51 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -146,8 +146,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) if (ret) goto out_free_stage2_pgd; - if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) + if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) { + ret = -ENOMEM; goto out_free_stage2_pgd; + } cpumask_copy(kvm->arch.supported_cpus, cpu_possible_mask); kvm_vgic_early_init(kvm);
If we fail to allocate the 'supported_cpus' cpumask in kvm_arch_init_vm() then be sure to return -ENOMEM instead of success (0) on the failure path. Signed-off-by: Will Deacon <will@kernel.org> --- arch/arm64/kvm/arm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)