[libvirt] [PATCH] storage: minor fix in luks encrypted volume creation

Katerina Koukiou kkoukiou at redhat.com
Wed Jun 6 14:54:20 UTC 2018


This patch fixes the case when creating a luks encrypted volume
via an xml file without 'secret' element.
libvirtd was receiving SIGSEGV, now proper error is reported for
the missing element. (see bz 1468422)

Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
---
 src/storage/storage_util.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 554fc757ed..18414ddb89 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1277,6 +1277,13 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool,
         return NULL;
     }
 
+    if (!enc->secrets) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("A single <secret type='passphrase'...> "
+                         "element is expected in encryption description"));
+        return NULL;
+    }
+
     conn = virGetConnectSecret();
     if (!conn)
         return NULL;
-- 
2.15.0




More information about the libvir-list mailing list