Skip to content

Commit ae41d7d

Browse files
sean-jcMarc Zyngier
authored andcommitted
KVM: arm64: Release pfn, i.e. put page, if copying MTE tags hits ZONE_DEVICE
Put the page reference acquired by gfn_to_pfn_prot() if kvm_vm_ioctl_mte_copy_tags() runs into ZONE_DEVICE memory. KVM's less- than-stellar heuristics for dealing with pfn-mapped memory means that KVM can get a page reference to ZONE_DEVICE memory. Fixes: f0376ed ("KVM: arm64: Add ioctl to fetch/store tags in a guest") Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Steven Price <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 38753cb commit ae41d7d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/arm64/kvm/guest.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ int kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm,
10591059
page = pfn_to_online_page(pfn);
10601060
if (!page) {
10611061
/* Reject ZONE_DEVICE memory */
1062+
kvm_release_pfn_clean(pfn);
10621063
ret = -EFAULT;
10631064
goto out;
10641065
}

0 commit comments

Comments
 (0)