Blame SOURCES/libvirt-storage-Fix-a-NULL-ptr-dereference-in-virStorageBackendCreateQemuImg.patch

6ae9ed
From 11b1557de30127ee20d51efa2034a0cc51f6c90b Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <11b1557de30127ee20d51efa2034a0cc51f6c90b@dist-git>
6ae9ed
From: Erik Skultety <eskultet@redhat.com>
6ae9ed
Date: Fri, 5 Aug 2016 09:45:49 +0200
6ae9ed
Subject: [PATCH] storage: Fix a NULL ptr dereference in
6ae9ed
 virStorageBackendCreateQemuImg
6ae9ed
6ae9ed
There was a missing check for vol->target.encryption being NULL
6ae9ed
at one particular place (modified by commit a48c71411) which caused a crash
6ae9ed
when user attempted to create a raw volume using a non-raw file volume as
6ae9ed
source.
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1363636
6ae9ed
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
(cherry picked from commit 5a3558c6201dc3aaef86166edce6b5edfe6800ad)
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
---
6ae9ed
 src/storage/storage_backend.c | 1 +
6ae9ed
 1 file changed, 1 insertion(+)
6ae9ed
6ae9ed
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
6ae9ed
index a338d81..9b6df58 100644
6ae9ed
--- a/src/storage/storage_backend.c
6ae9ed
+++ b/src/storage/storage_backend.c
6ae9ed
@@ -1459,6 +1459,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
6ae9ed
         goto cleanup;
6ae9ed
 
6ae9ed
     if (vol->target.format == VIR_STORAGE_FILE_RAW &&
6ae9ed
+        vol->target.encryption &&
6ae9ed
         vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
6ae9ed
         if (!(secretPath =
6ae9ed
               virStorageBackendCreateQemuImgSecretPath(conn, pool, vol)))
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed