linux-stable/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
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 KVM: arm64: Remove unused __sve_save_state 2021-11-22 16:01:39 +00:00
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 arm64: alternatives: have callbacks take a cap 2022-09-16 17:15:03 +01:00
Makefile KVM: arm64: Enable stack protection and branch profiling for VHE 2022-10-09 03:15:55 +01:00
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 KVM: arm64: Treat ESR_EL2 as a 64-bit register 2022-04-29 19:26:27 +01:00