From fab2e49d3c290bfd122aad39b9484f60c5354256 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Wed, 6 Jun 2018 16:15:19 +0200 Subject: [PATCH] storage: fix crash in luks encrypted volume creation Fix 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. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468422 Signed-off-by: Katerina Koukiou --- 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..87f2115869 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1277,6 +1277,13 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool, return NULL; } + if (enc->nsecrets != 1) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("A single " + "element is expected in encryption description")); + return NULL; + } + conn = virGetConnectSecret(); if (!conn) return NULL; -- 2.39.5