Thread (63 messages) 63 messages, 3 authors, 2026-03-23

Re: [PATCH v3 01/36] KVM: arm64: Don't leak stage-2 page-table if VM fails to init under pKVM

From: Fuad Tabba <tabba@google.com>
Date: 2026-03-11 12:49:34
Also in: kvmarm

On Thu, 5 Mar 2026 at 14:44, Will Deacon [off-list ref] wrote:
If pkvm_init_host_vm() fails, we should free the stage-2 page-table
previously allocated by kvm_init_stage2_mmu().

Cc: Fuad Tabba <tabba@google.com>
Fixes: 07aeb70707b1 ("KVM: arm64: Reserve pKVM handle during pkvm_init_host_vm()")
Signed-off-by: Will Deacon <will@kernel.org>
Thanks for catching this!

Reviewed-by: Fuad Tabba <tabba@google.com>

Cheers,
/fuad

quoted hunk ↗ jump to hunk
---
 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 410ffd41fd73..3589fc08266c 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -236,7 +236,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
                 */
                ret = pkvm_init_host_vm(kvm);
                if (ret)
-                       goto err_free_cpumask;
+                       goto err_uninit_mmu;
        }

        kvm_vgic_early_init(kvm);
@@ -252,6 +252,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)

        return 0;

+err_uninit_mmu:
+       kvm_uninit_stage2_mmu(kvm);
 err_free_cpumask:
        free_cpumask_var(kvm->arch.supported_cpus);
 err_unshare_kvm:
--
2.53.0.473.g4a7958ca14-goog
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help