[PATCH] qemu: migration: Unlock vm if ACL check in Finish phase of protocol v2 fails

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

 



Avoid leaving the domain locked on a failed ACL check. Introduced in
commit abf75aea247e (Add ACL checks into the QEMU driver).
---
 src/qemu/qemu_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8cec372..0a684e1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11447,41 +11447,43 @@ static virDomainPtr
 qemuDomainMigrateFinish2(virConnectPtr dconn,
                          const char *dname,
                          const char *cookie ATTRIBUTE_UNUSED,
                          int cookielen ATTRIBUTE_UNUSED,
                          const char *uri ATTRIBUTE_UNUSED,
                          unsigned long flags,
                          int retcode)
 {
     virQEMUDriverPtr driver = dconn->privateData;
     virDomainObjPtr vm;
     virDomainPtr dom = NULL;

     virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);

     vm = virDomainObjListFindByName(driver->domains, dname);
     if (!vm) {
         virReportError(VIR_ERR_NO_DOMAIN,
                        _("no domain with matching name '%s'"), dname);
         goto cleanup;
     }

-    if (virDomainMigrateFinish2EnsureACL(dconn, vm->def) < 0)
+    if (virDomainMigrateFinish2EnsureACL(dconn, vm->def) < 0) {
+        virObjectUnlock(vm);
         goto cleanup;
+    }

     /* Do not use cookies in v2 protocol, since the cookie
      * length was not sufficiently large, causing failures
      * migrating between old & new libvirtd
      */
     dom = qemuMigrationFinish(driver, dconn, vm,
                               NULL, 0, NULL, NULL, /* No cookies */
                               flags, retcode, false);

  cleanup:
     return dom;
 }


 /*******************************************************************
  * Migration Protocol Version 3
  *******************************************************************/

-- 
2.1.0

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