qemuDomainGetImageIds did not check if there was a label
in the seclabel, thus crashing on
<seclabel type='none' model='dac'/>
---
src/qemu/qemu_domain.c | 3 ++-
src/qemu/qemu_driver.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 962698b..e40c5ec 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2409,7 +2409,8 @@ qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg,
*gid = cfg->group;
}
- if (vm && (vmlabel = virDomainDefGetSecurityLabelDef(vm->def,
"dac")))
+ if (vm && (vmlabel = virDomainDefGetSecurityLabelDef(vm->def,
"dac")) &&
+ vmlabel->label)
virParseOwnershipIds(vmlabel->label, uid, gid);
if ((disklabel = virDomainDiskDefGetSecurityLabelDef(disk, "dac"))
&&
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ec72d9d..e147d28 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2771,6 +2771,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
/* TODO: Take imagelabel into account? */
if (vm &&
(seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL
&&
+ seclabel->label != NULL &&
(virParseOwnershipIds(seclabel->label, &user, &group) < 0))
goto cleanup;
--
1.8.5.5