From: Michal Privoznik Date: Fri, 23 Aug 2019 13:11:20 +0000 (+0200) Subject: storage_driver: Don't crash in storagePoolCreateXML X-Git-Tag: v5.7.0-rc1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9935b435dfee4d130197ee62ae64880ccbcf1855;p=thirdparty%2Flibvirt.git storage_driver: Don't crash in storagePoolCreateXML 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 Reviewed-by: Martin Kletzander --- diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index cd9f14a2c0..30940b5dcf 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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);