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 <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2019-08-23 15:11:20 +02:00
parent 277c8c4c9b
commit 9935b435df
1 changed files with 1 additions and 1 deletions

View 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);