get_vcpu_from_collection() can return NULL if the collection entry
cannot be read or does not identify a vCPU. its_handle_invall() then
dereferences NULL when taking the vCPU's vGIC lock, crashing the
hypervisor.
Return -ENOENT to the vITS command dispatcher when the lookup fails.
Fixes: e975cca32bde ("ARM: vITS: handle INVALL command")
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
---
xen/arch/arm/vgic-v3-its.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 79d056e21a..b2103d820d 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -533,6 +533,9 @@ static int its_handle_invall(struct virt_its *its, uint64_t *cmdptr)
vcpu = get_vcpu_from_collection(its, collid);
spin_unlock(&its->its_lock);
+ if ( !vcpu )
+ return -ENOENT;
+
spin_lock_irqsave(&vcpu->arch.vgic.lock, flags);
read_lock(&its->d->arch.vgic.pend_lpi_tree_lock);
--
2.53.0