All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections
@ 2019-12-13  9:42 ` Eric Auger
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Auger @ 2019-12-13  9:42 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, maz, linux-kernel, kvmarm

Saving/restoring an unmapped collection is a valid scenario. For
example this happens if a MAPTI command was sent, featuring an
unmapped collection. At the moment the CTE fails to be restored.
Only compare against the number of online vcpus if the rdist
base is set.

Cc: stable@vger.kernel.org # v4.11+
Fixes: ea1ad53e1e31a ("KVM: arm64: vgic-its: Collection table save/restore")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 virt/kvm/arm/vgic/vgic-its.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 98c7360d9fb7..17920d1b350a 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -2475,7 +2475,8 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz)
 	target_addr = (u32)(val >> KVM_ITS_CTE_RDBASE_SHIFT);
 	coll_id = val & KVM_ITS_CTE_ICID_MASK;
 
-	if (target_addr >= atomic_read(&kvm->online_vcpus))
+	if (target_addr != COLLECTION_NOT_MAPPED &&
+	    target_addr >= atomic_read(&kvm->online_vcpus))
 		return -EINVAL;
 
 	collection = find_collection(its, coll_id);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-12-13 21:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13  9:42 [PATCH] KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections Eric Auger
2019-12-13  9:42 ` Eric Auger
2019-12-13 10:43 ` Marc Zyngier
2019-12-13 10:43   ` Marc Zyngier
2019-12-13 10:55   ` Auger Eric
2019-12-13 10:55     ` Auger Eric
2019-12-13 10:53 ` Zenghui Yu
2019-12-13 10:53   ` Zenghui Yu
2019-12-13 11:06   ` Auger Eric
2019-12-13 11:06     ` Auger Eric
2019-12-13 11:28   ` Marc Zyngier
2019-12-13 11:28     ` Marc Zyngier
2019-12-13 14:22     ` Zenghui Yu
2019-12-13 14:22       ` Zenghui Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.