Re: Segfault in virDomainObjListSearchName when listing domains (qemu backend)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 28, 2010 at 06:06:00PM +0200, Guido Winkelmann wrote:
> Another segfault, again after calling list in virsh after a domain failed to 
> start:

I haven't reproduced the crashes, but try this patch which I think might
solve one possible flaw.

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6ae4e8c..26d935a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1178,9 +1178,10 @@ static void qemuHandleMonitorDestroy(qemuMonitorPtr mon,
                                      virDomainObjPtr vm)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    if (priv->mon == mon)
+    if (mon && (priv->mon == mon)) {
         priv->mon = NULL;
-    virDomainObjUnref(vm);
+        virDomainObjUnref(vm);
+    }
 }
 
 static qemuMonitorCallbacks monitorCallbacks = {
@@ -1212,6 +1213,8 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
      * deleted while the monitor is active */
     virDomainObjRef(vm);
 
+    priv->mon = NULL; /* Explicitly nullify it so destroy callback sees NULL
+                       * if it is invoked during construction */
     priv->mon = qemuMonitorOpen(vm,
                                 priv->monConfig,
                                 priv->monJSON,


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]