UPSTREAM: KVM: arm64: Return -EPERM from __pkvm_host_share_hyp()

Fix the error code returned by __pkvm_host_share_hyp() when the
host attempts to share with EL2 a page that has already been shared with
another entity.

Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210811173630.2536721-1-qperret@google.com
(cherry picked from commit 12593568d7)
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 198418208
Change-Id: I6d657185b1182a3d81f5f19d59fec494fc419cdd
This commit is contained in:
Quentin Perret
2021-08-11 18:36:25 +01:00
committed by Will Deacon
parent eb295b0b0f
commit 75815831b4

View File

@@ -404,7 +404,7 @@ int __pkvm_host_share_hyp(u64 pfn)
cur = kvm_pgtable_hyp_pte_prot(pte);
prot = pkvm_mkstate(PAGE_HYP, PKVM_PAGE_SHARED_BORROWED);
if (!check_prot(cur, prot, ~prot))
ret = EPERM;
ret = -EPERM;
goto unlock;
map_shared: