]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU
authorJiri Denemark <jdenemar@redhat.com>
Tue, 18 Feb 2025 10:24:32 +0000 (11:24 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 18 Feb 2025 11:08:14 +0000 (12:08 +0100)
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>
src/qemu/qemu_domain.c

index cf05dca55ae1b54b21c93d52b8de794a2759daca..df1ed0223d3e4659813e3eefec711aa86f48df17 100644 (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)