mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Avoid crash in security driver if model is NULL
If the XML security model is NULL, it is assumed that the current model will be used with dynamic labelling. The verify step is meaningless and potentially crashes if dereferencing NULL * src/security/security_manager.c: Skip NULL model on verify
This commit is contained in:
parent
bda57661b8
commit
31c698d76d
@ -309,6 +309,14 @@ int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr,
|
||||
int virSecurityManagerVerify(virSecurityManagerPtr mgr,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
const virSecurityLabelDefPtr secdef = &def->seclabel;
|
||||
/* NULL model == dynamic labelling, with whatever driver
|
||||
* is active, so we can short circuit verify check to
|
||||
* avoid drivers de-referencing NULLs by accident
|
||||
*/
|
||||
if (!secdef->model)
|
||||
return 0;
|
||||
|
||||
if (mgr->drv->domainSecurityVerify)
|
||||
return mgr->drv->domainSecurityVerify(mgr, def);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user