acrn-kernel/arch/arm64/kvm/hyp
Oliver Upton f6a27d6dc5 KVM: arm64: Drop last page ref in kvm_pgtable_stage2_free_removed()
The reference count on page table allocations is increased for every
'counted' PTE (valid or donated) in the table in addition to the initial
reference from ->zalloc_page(). kvm_pgtable_stage2_free_removed() fails
to drop the last reference on the root of the table walk, meaning we
leak memory.

Fix it by dropping the last reference after the free walker returns,
at which point all references for 'counted' PTEs have been released.

Cc: stable@vger.kernel.org
Fixes: 5c359cca1f ("KVM: arm64: Tear down unlinked stage-2 subtree after break-before-make")
Reported-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Tested-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230530193213.1663411-1-oliver.upton@linux.dev
2023-05-31 08:02:21 +01:00
..
include KVM: arm64: Populate fault info for watchpoint 2023-05-30 08:39:07 +01:00
nvhe KVM: arm64: Populate fault info for watchpoint 2023-05-30 08:39:07 +01:00
vhe KVM: arm64: Populate fault info for watchpoint 2023-05-30 08:39:07 +01:00
Makefile
aarch32.c
entry.S KVM: arm64: Use symbolic definition for ISR_EL1.A 2023-01-12 16:31:33 +00:00
exception.c KVM: arm64: nv: Support virtual EL2 exceptions 2023-02-11 09:16:11 +00:00
fpsimd.S
hyp-constants.c KVM: arm64: Instantiate pKVM hypervisor VM and vCPU structures from EL1 2022-11-11 17:16:24 +00:00
hyp-entry.S
pgtable.c KVM: arm64: Drop last page ref in kvm_pgtable_stage2_free_removed() 2023-05-31 08:02:21 +01:00
vgic-v2-cpuif-proxy.c
vgic-v3-sr.c