[libvirt] [PATCH] qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal

Erik Skultety posted 1 patch 4 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/0c320d39dd05607f89255e6559a943c050fadcff.1574081795.git.eskultet@redhat.com
src/qemu/qemu_domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH] qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal
Posted by Erik Skultety 4 years, 5 months ago
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 <eskultet@redhat.com>
---
 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 e14b414518..ed2a5cc7b6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9105,7 +9105,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
                 goto cleanup;
         }
 
-        if (qemuDomainMakeCPUMigratable(def->cpu) < 0)
+        if (def->cpu && qemuDomainMakeCPUMigratable(def->cpu) < 0)
             goto cleanup;
     }
 
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] qemu: Fix NULL ptr dereference caused by qemuDomainDefFormatBufInternal
Posted by Daniel Henrique Barboza 4 years, 5 months ago

On 11/18/19 9:57 AM, Erik Skultety wrote:
> 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 <eskultet@redhat.com>
> ---


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list