]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage_driver: Don't crash in storagePoolCreateXML
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Aug 2019 13:11:20 +0000 (15:11 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 23 Aug 2019 13:33:47 +0000 (15:33 +0200)
In my recent patches I've introduced
virStoragePoolObjIsStarting() which is then used to protect
storage pool definition when the pool object is locked and
unlocked during long running jobs. Well, my patches did not
anticipate that @obj can be NULL under 'cleanup' label in
storagePoolCreateXML() (for instance when parsing XML fails).
This imperfection is causing libvirtd to crash then.

Fixes: 13284a6b83 storage_driver: Protect pool def during startup and build
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/storage/storage_driver.c

index cd9f14a2c0b3afb633f4b6e682e21775cb304700..30940b5dcf924ad122765a32936827f77aad3863 100644 (file)
@@ -808,7 +808,7 @@ storagePoolCreateXML(virConnectPtr conn,
     pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
 
  cleanup:
-    if (virStoragePoolObjIsStarting(obj)) {
+    if (obj && virStoragePoolObjIsStarting(obj)) {
         if (!virStoragePoolObjIsActive(obj))
             virStoragePoolUpdateInactive(obj);
         virStoragePoolObjSetStarting(obj, false);