提交 7eb0ee17 编写于 作者: J Ján Tomko

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
上级 fdfdbc0d
...@@ -2409,7 +2409,8 @@ qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, ...@@ -2409,7 +2409,8 @@ qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg,
*gid = cfg->group; *gid = cfg->group;
} }
if (vm && (vmlabel = virDomainDefGetSecurityLabelDef(vm->def, "dac"))) if (vm && (vmlabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) &&
vmlabel->label)
virParseOwnershipIds(vmlabel->label, uid, gid); virParseOwnershipIds(vmlabel->label, uid, gid);
if ((disklabel = virDomainDiskDefGetSecurityLabelDef(disk, "dac")) && if ((disklabel = virDomainDiskDefGetSecurityLabelDef(disk, "dac")) &&
......
...@@ -2771,6 +2771,7 @@ qemuOpenFile(virQEMUDriverPtr driver, ...@@ -2771,6 +2771,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
/* TODO: Take imagelabel into account? */ /* TODO: Take imagelabel into account? */
if (vm && if (vm &&
(seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL && (seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL &&
seclabel->label != NULL &&
(virParseOwnershipIds(seclabel->label, &user, &group) < 0)) (virParseOwnershipIds(seclabel->label, &user, &group) < 0))
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册