Skip to contentSkip to conversation

KVM: arm64: Return -EPERM from __pkvm_host_share_hyp()

PATCH Applied Quentin Perret 2 participants 2 messages Aug 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
This patch fixes a bug introduced in the stage-2 ownership series which is already queued in kvmarm/next:

https://lore.kernel.org/lkml/[email protected]/

I've starred at this code for hours, but that clearly was not enough. Oh well ...

---
 arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/hyp/nvhe/mem_protect.c +1 -1
index 8165390d3ec9..6ec695311498 100644
@@ -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:
Signature · 1 line
2.32.0.605.g8dce9f2422-goog
maintainer Applied
#1 lore raw
Quoted 3 lines · Quentin Perret

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.

Applied to next, thanks!

[1/1] KVM: arm64: Return -EPERM from __pkvm_host_share_hyp()

      commit: 12593568d7319c34c72038ea799ab1bd0f0eb01c

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.