From 63d6271b0ed420fe4ef986209ea71fda23e7795a Mon Sep 17 00:00:00 2001 Message-Id: <63d6271b0ed420fe4ef986209ea71fda23e7795a@dist-git> From: Erik Skultety Date: Mon, 18 Nov 2019 15:18:11 +0100 Subject: [PATCH] qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal qemuDomainDefFormatBufInternal function wasn't testing whether the CPU was actually defined in the XML and saving such a domain resulted in the following backtrace: 0 in qemuDomainMakeCPUMigratable (cpu=0x0) 1 in qemuDomainDefFormatBufInternal() 2 in qemuDomainDefFormatXMLInternal() 3 in qemuDomainDefFormatLive() 4 in qemuDomainSaveInternal() 5 in qemuDomainSaveFlags() 6 in qemuDomainSave() 7 in virDomainSave() Signed-off-by: Erik Skultety Reviewed-by: Daniel Henrique Barboza (cherry picked from commit 2816fe2e846ab3bd2bfbef123c426a17f1e1df98) https://bugzilla.redhat.com/show_bug.cgi?id=1749672 https://bugzilla.redhat.com/show_bug.cgi?id=1756156 https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Signed-off-by: Jiri Denemark Message-Id: Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f45d7d427e..6b867ad669 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7543,7 +7543,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainMakeCPUMigratable(def->cpu) < 0) + if (def->cpu && qemuDomainMakeCPUMigratable(def->cpu) < 0) goto cleanup; } -- 2.24.0