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(a)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