提交 06e612e9 编写于 作者: M Michal Privoznik 提交者: Doug Goldstein

lxcCapsInit: Allocate primary security driver unconditionally

Currently, if the primary security driver is 'none', we skip
initializing caps->host.secModels. This means, later, when LXC domain
XML is parsed and <seclabel type='none'/> is found (see
virSecurityLabelDefsParseXML), the model name is not copied to the
seclabel. This leads to subsequent crash in virSecurityManagerGenLabel
where we call STREQ() over the model (note, that we are expecting model
to be !NULL).
(cherry picked from commit 37d96498)

Conflicts:
	src/lxc/lxc_conf.c
上级 7f72e6c3
...@@ -114,16 +114,15 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver) ...@@ -114,16 +114,15 @@ virCapsPtr lxcCapsInit(virLXCDriverPtr driver)
doi = virSecurityManagerGetDOI(driver->securityManager); doi = virSecurityManagerGetDOI(driver->securityManager);
model = virSecurityManagerGetModel(driver->securityManager); model = virSecurityManagerGetModel(driver->securityManager);
if (STRNEQ(model, "none")) {
/* Allocate just the primary security driver for LXC. */ /* Allocate just the primary security driver for LXC. */
if (VIR_ALLOC(caps->host.secModels) < 0) if (VIR_ALLOC(caps->host.secModels) < 0)
goto no_memory; goto no_memory;
caps->host.nsecModels = 1; caps->host.nsecModels = 1;
if (VIR_STRDUP(caps->host.secModels[0].model, model) < 0) if (VIR_STRDUP(caps->host.secModels[0].model, model) < 0)
goto error; goto error;
if (VIR_STRDUP(caps->host.secModels[0].doi, doi) < 0) if (VIR_STRDUP(caps->host.secModels[0].doi, doi) < 0)
goto error; goto error;
}
VIR_DEBUG("Initialized caps for security driver \"%s\" with " VIR_DEBUG("Initialized caps for security driver \"%s\" with "
"DOI \"%s\"", model, doi); "DOI \"%s\"", model, doi);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册