]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDomainDeviceValidateAliasForHotplug: Use correct domain defintion
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 9 Mar 2018 07:31:44 +0000 (08:31 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 12 Mar 2018 12:27:24 +0000 (13:27 +0100)
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>
src/conf/domain_conf.c

index 70b19311b478fe4f453247e1c35e3cfca81e321f..b98b1ca4289f272caba4ce9ee280d779402a9e30 100644 (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;