From: Michal Privoznik Date: Fri, 9 Mar 2018 07:31:44 +0000 (+0100) Subject: virDomainDeviceValidateAliasForHotplug: Use correct domain defintion X-Git-Tag: v4.2.0-rc1~213 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5673ed44465edcfccdd906158136ad8dcb94b9b;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 70b19311b4..b98b1ca428 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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;