Commit ae41d7db authored by Sean Christopherson's avatar Sean Christopherson Committed by Marc Zyngier

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: f0376edb ("KVM: arm64: Add ioctl to fetch/store tags in a guest")
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarSteven Price <steven.price@arm.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20240726235234.228822-2-seanjc@google.comSigned-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 38753cbc
......@@ -1059,6 +1059,7 @@ int kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm,
page = pfn_to_online_page(pfn);
if (!page) {
/* Reject ZONE_DEVICE memory */
kvm_release_pfn_clean(pfn);
ret = -EFAULT;
goto out;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment