linux/arch/arm64/kvm
Fuad Tabba 05ec0186b4 KVM: arm64: Fix page leak in user_mem_abort()
commit 5f9466b50c upstream.

The user_mem_abort() function acquires a page reference via
__kvm_faultin_pfn() early in its execution. However, the subsequent
checks for mismatched attributes between stage 1 and stage 2 mappings
would return an error code directly, bypassing the corresponding page
release.

Fix this by storing the error and releasing the unused page before
returning the error.

Fixes: 6d674e28f6 ("KVM: arm/arm64: Properly handle faulting of device mappings")
Fixes: 2a8dfab266 ("KVM: arm64: Block cacheable PFNMAP mapping")
Signed-off-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-19 16:37:18 +02:00
..
hyp KVM: arm64: Fix debug checking for np-guests using huge mappings 2025-10-19 16:37:18 +02:00
vgic KVM: arm64: vgic: fix incorrect spinlock API usage 2025-09-10 02:56:20 -07:00
.gitignore KVM: arm64: Generate hyp_constants.h for the host 2021-12-06 08:37:03 +00:00
arch_timer.c KVM: arm64: Add helper to identify a nested context 2025-07-08 10:40:30 -07:00
arm.c KVM: arm64: Initialize PMSCR_EL1 when in VHE 2025-09-10 02:56:19 -07:00
at.c KVM: arm64: nv: Fix ATS12 handling of single-stage translation 2025-08-28 12:44:42 -07:00
config.c Merge branch 'kvm-arm64/config-masks' into kvmarm/next 2025-07-28 08:03:08 -07:00
debug.c KVM: arm64: VHE: Save and restore host MDCR_EL2 value correctly 2025-09-10 02:56:19 -07:00
emulate-nested.c KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection 2025-08-15 11:51:18 -07:00
fpsimd.c KVM: arm64: Remove kvm_arch_vcpu_run_map_fp() 2025-07-03 10:39:24 +01:00
guest.c KVM: arm64: Commit exceptions from KVM_SET_VCPU_EVENTS immediately 2025-07-15 20:12:03 -07:00
handle_exit.c KVM: arm64: nv: Honor SError exception routing / masking 2025-07-08 11:36:31 -07:00
hypercalls.c arm64: kvm, smccc: Introduce and use API for getting hypervisor UUID 2025-05-23 16:30:55 +00:00
inject_fault.c KVM: arm64: Populate ESR_ELx.EC for emulated SError injection 2025-07-09 09:55:05 -07:00
Kconfig arm64: drop binutils version checks 2025-04-30 21:55:06 +02:00
Makefile KVM: arm64: gic-v5: Probe for GICv5 2025-07-08 14:41:06 -07:00
mmio.c KVM: arm64: Don't retire MMIO instruction w/ pending (emulated) SError 2025-07-08 11:36:36 -07:00
mmu.c KVM: arm64: Fix page leak in user_mem_abort() 2025-10-19 16:37:18 +02:00
nested.c KVM: arm64: nv: Fix incorrect VNCR invalidation range calculation 2025-09-10 02:56:20 -07:00
pauth.c KVM: arm64: nv: Work around lack of pauth support in old toolchains 2024-04-23 19:27:11 +01:00
pkvm.c Revert "KVM: arm64: Split kvm_pgtable_stage2_destroy()" 2025-09-10 11:11:22 -07:00
pmu-emul.c KVM: arm64: Add RMW specific sysreg accessor 2025-06-05 14:18:01 +01:00
pmu.c KVM: arm64: Use a cpucap to determine if system supports FEAT_PMUv3 2025-03-11 12:54:23 -07:00
psci.c KVM: arm64: Add support for PSCI v1.2 and v1.3 2024-10-24 16:38:07 -07:00
ptdump.c KVM: arm64: ptdump: Test PMD_TYPE_MASK for block mapping 2025-03-12 12:20:59 +00:00
pvtime.c KVM: MMU: Make the definition of 'INVALID_GPA' common 2023-01-19 21:48:38 +00:00
reset.c KVM: arm64: nv: Add pseudo-TLB backing VNCR_EL2 2025-05-19 07:59:46 +01:00
stacktrace.c arm64: kvm: Introduce nvhe stack size constants 2025-01-08 11:25:28 +00:00
sys_regs.c KVM/arm64 changes for 6.17, take #2 2025-08-29 12:57:31 -04:00
sys_regs.h arm64: kvm: sys_regs: use string choices helper 2025-07-23 23:36:37 -07:00
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
trace_arm.h KVM: arm64: Replace ternary flags with str_on_off() helper 2025-05-06 09:38:37 +01:00
trace_handle_exit.h arm64: kvm: trace_handle_exit: use string choices helper 2025-07-23 23:36:55 -07:00
trng.c KVM: arm64: Implement the TRNG hypervisor call 2021-01-25 22:19:31 +00:00
va_layout.c arm64: alternatives: kvm: prepare for cap changes 2022-09-16 17:15:02 +01:00
vgic-sys-reg-v3.c KVM: arm64: Enforce the sorting of the GICv3 system register table 2025-07-26 08:36:58 -07:00
vmid.c KVM: arm64: Ensure a VMID is allocated before programming VTTBR_EL2 2025-02-20 16:29:28 +00:00