KVM: arm64: Pass the actual page address to mte_clear_page_tags()
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 19 Jan 2023 17:09:02 +0000 (17:09 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 21 Jan 2023 11:02:19 +0000 (11:02 +0000)
Commit d77e59a8fccd ("arm64: mte: Lock a page for MTE tag
initialisation") added a call to mte_clear_page_tags() in case a
prior mte_copy_tags_from_user() failed in order to avoid stale tags in
the guest page (it should have really been a separate commit).
Unfortunately, the argument passed to this function was the address of
the struct page rather than the actual page address. Fix this function
call.

Fixes: d77e59a8fccd ("arm64: mte: Lock a page for MTE tag initialisation")
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230119170902.1574756-1-catalin.marinas@arm.com
arch/arm64/kvm/guest.c

index 5626ddb540ce3333d561f9e61c13d3a695f859fe..cf4c495a4321332b7bc5a1979fc84d3084da355e 100644 (file)
@@ -1079,7 +1079,7 @@ long kvm_vm_ioctl_mte_copy_tags(struct kvm *kvm,
 
                        /* uaccess failed, don't leave stale tags */
                        if (num_tags != MTE_GRANULES_PER_PAGE)
-                               mte_clear_page_tags(page);
+                               mte_clear_page_tags(maddr);
                        set_page_mte_tagged(page);
 
                        kvm_release_pfn_dirty(pfn);