mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
Fix crash in DAC driver with no seclabels
With dynamic_ownership = 1 but no seclabels, RestoreChardevLabel dereferences the NULL seclabel when checking if norelabel is set. Remove this check, since it is already done in RestoreSecurityAllLabel and if norelabel is set, RestoreChardevLabel is never called.
This commit is contained in:
parent
4bafe31264
commit
88e36a69de
@ -768,22 +768,19 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
|
||||
|
||||
static int
|
||||
virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
|
||||
virDomainDefPtr def,
|
||||
virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
virDomainChrDefPtr dev,
|
||||
virDomainChrSourceDefPtr dev_source)
|
||||
{
|
||||
virSecurityLabelDefPtr seclabel;
|
||||
virSecurityDeviceLabelDefPtr chr_seclabel = NULL;
|
||||
char *in = NULL, *out = NULL;
|
||||
int ret = -1;
|
||||
|
||||
seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
|
||||
|
||||
if (dev)
|
||||
chr_seclabel = virDomainChrDefGetSecurityLabelDef(dev,
|
||||
SECURITY_DAC_NAME);
|
||||
|
||||
if (seclabel->norelabel || (chr_seclabel && chr_seclabel->norelabel))
|
||||
if (chr_seclabel && chr_seclabel->norelabel)
|
||||
return 0;
|
||||
|
||||
switch ((enum virDomainChrType) dev_source->type) {
|
||||
|
Loading…
Reference in New Issue
Block a user