virDomainDeviceValidateAliasForHotplug: Use correct domain defintion

https://bugzilla.redhat.com/show_bug.cgi?id=1553075

For some weird reason this function is getting live and
persistent def for domain but then accesses vm->def and
vm->newDef directly. This is rather unsafe as we can be
accessing NULL pointer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2018-03-09 08:31:44 +01:00
parent fc0f856315
commit e5673ed444

View File

@ -5679,11 +5679,11 @@ virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
return -1;
if (persDef &&
virDomainDeviceValidateAliasImpl(vm->def, dev) < 0)
virDomainDeviceValidateAliasImpl(persDef, dev) < 0)
return -1;
if (liveDef &&
virDomainDeviceValidateAliasImpl(vm->newDef, dev) < 0)
virDomainDeviceValidateAliasImpl(liveDef, dev) < 0)
return -1;
return 0;