[PATCH 1/2] esx: Do not crash SetAutoStart by double free

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

 



SetAutoStart method cannot free virtualMachine using
esxVI_ObjectContent_Free, since:

esxVI_HostAutoStartManagerConfig_Free
 -> esxVI_AutoStartPowerInfo_Free
   -> esxVI_ManagedObjectReference_Free(item->key);

item->key, in this context, is virtualMachine->obj, so calling
esxVI_ObjectContent_Free creates a double free, becasuse
esxVI_ObjectContent_Free also calls esxVI_ManagedObjectReference_Free(&item->obj).

Removing the esxVI_ObjectContent_Free from SetAutoStart fixes this
problem.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
---
 src/esx/esx_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index cee98ebcaf..3835e4cb3c 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3421,7 +3421,9 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
         newPowerInfo->stopAction = NULL;
     }
 
-    esxVI_ObjectContent_Free(&virtualMachine);
+    /* HostAutoStartManagerConfig free method will call autoStartPowerInfoFree
+     * in order to free virtualMachine, since  newPowerInfo-> key points to
+     * virtualMachine */
     esxVI_HostAutoStartManagerConfig_Free(&spec);
     esxVI_AutoStartDefaults_Free(&defaults);
     esxVI_AutoStartPowerInfo_Free(&powerInfoList);
-- 
2.17.1

--
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]

  Powered by Linux