]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf: fix crash in virDomainObjListFindByUUIDInternal
authorMichael Chapman <mike@very.puzzling.org>
Wed, 11 Mar 2015 02:19:54 +0000 (13:19 +1100)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:06:40 +0000 (11:06 -0400)
If a domain object is being removed and looked up concurrently we must
ensure we unlock the object before unreferencing it, since the latter
might free the object.

The flaw was introduced in commit feb1a4d792e1c35b1009e69c00bf351b39.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
(cherry picked from commit 616003d6bd5a3d87d6d529ddb6d83715979d903c)

src/conf/domain_conf.c

index 245d017dfda82c2a8fb2a6c0894077736dbf9ebc..f9734b5acb3c62c9b6fb1a1ab813f558999d10dd 100644 (file)
@@ -1068,9 +1068,9 @@ virDomainObjListFindByUUIDInternal(virDomainObjListPtr doms,
     if (obj) {
         virObjectLock(obj);
         if (obj->removing) {
+            virObjectUnlock(obj);
             if (ref)
                 virObjectUnref(obj);
-            virObjectUnlock(obj);
             obj = NULL;
         }
     }