]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Fix a NULL ptr dereference in virStorageBackendCreateQemuImg
authorErik Skultety <eskultet@redhat.com>
Wed, 3 Aug 2016 10:08:41 +0000 (12:08 +0200)
committerErik Skultety <eskultet@redhat.com>
Fri, 5 Aug 2016 07:07:00 +0000 (09:07 +0200)
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 <eskultet@redhat.com>
src/storage/storage_backend.c

index 1f33181ef85965ece5fb1ea8e9afb81b198473ce..d4334dca223c1eca1eeb0e7856ccd3dc740393c5 100644 (file)
@@ -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)))