Fix crash when saving a domain with type none dac label

qemuDomainGetImageIds did not check if there was a label
in the seclabel, thus crashing on
<seclabel type='none' model='dac'/>

https://bugzilla.redhat.com/show_bug.cgi?id=1108590
This commit is contained in:
Ján Tomko 2014-06-12 10:50:43 +02:00
parent fdfdbc0d12
commit 7eb0ee175b
2 changed files with 3 additions and 1 deletions

View File

@ -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")) &&

View File

@ -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;