From: Quentin Perret Date: Wed, 11 Aug 2021 17:36:25 +0000 (+0100) Subject: KVM: arm64: Return -EPERM from __pkvm_host_share_hyp() X-Git-Tag: v5.15-rc1~65^2~4^2~5^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12593568d7319c34c72038ea799ab1bd0f0eb01c;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210811173630.2536721-1-qperret@google.com --- diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 8165390d3ec99..6ec6953114986 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -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: