[libvirt] [PATCH] qemu: perf: Fix crash/memory corruption on failed VM start

Peter Krempa pkrempa at redhat.com
Thu Apr 7 10:52:19 UTC 2016


The new perf code didn't bother to clear a pointer in 'priv' causing a
double free or other memory corruption goodness if a VM failed to start.

Clear the pointer after freeing the memory.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324757
---
 src/qemu/qemu_process.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2b600c1..6c870f5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3444,6 +3444,7 @@ qemuDomainPerfRestart(virDomainObjPtr vm)

  cleanup:
     virPerfFree(priv->perf);
+    priv->perf = NULL;
     return -1;
 }

@@ -5970,6 +5971,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virCgroupFree(&priv->cgroup);

     virPerfFree(priv->perf);
+    priv->perf = NULL;

     qemuProcessRemoveDomainStatus(driver, vm);

-- 
2.8.0




More information about the libvir-list mailing list