From: Erik Skultety Date: Wed, 3 Aug 2016 10:08:41 +0000 (+0200) Subject: storage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg X-Git-Tag: v2.2.0-rc1~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a3558c6201dc3aaef86166edce6b5edfe6800ad;p=thirdparty%2Flibvirt.git storage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg There was a missing check for vol->target.encryption being NULL at one particular place (modified by commit a48c71411) which caused a crash when user attempted to create a raw volume using a non-raw file volume as source. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1363636 Signed-off-by: Erik Skultety --- diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 1f33181ef8..d4334dca22 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1459,6 +1459,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, goto cleanup; if (vol->target.format == VIR_STORAGE_FILE_RAW && + vol->target.encryption && vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) { if (!(secretPath = virStorageBackendCreateQemuImgSecretPath(conn, pool, vol)))