]> 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)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 11 Mar 2015 07:20:51 +0000 (08:20 +0100)
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>
src/conf/domain_conf.c

index a8f4ce26df851d4d92205ba96486b8bc892e7a1a..83f3ec673175ee366a402c0f41984c82bbe5671a 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;
         }
     }