render / rpms / libvirt

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