1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU

When we don't have any information about host CPU (for example when
running on an aarch64 host), the virQEMUCapsGetHostModel would return
NULL.

Fixes: f928eb5fc80ca0ed7277f2513b63aed36c09d275
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/747
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Tested-by: Jaroslav Suchanek <jsuchane@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jiri Denemark 2025-02-18 11:24:32 +01:00
parent 08db3e8dc2
commit 43eae1b707

View File

@ -11430,6 +11430,7 @@ qemuDomainCheckCPU(virArch arch,
/* Force compat check if the CPU model is not found in qemuCaps or
* we don't have host CPU data from QEMU */
if (!cpu->model ||
!hypervisorCPU ||
hypervisorCPU->fallback != VIR_CPU_FALLBACK_FORBID ||
virQEMUCapsGetCPUBlockers(qemuCaps, virtType,
cpu->model, &blockers) < 0)