From e5673ed44465edcfccdd906158136ad8dcb94b9b Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 9 Mar 2018 08:31:44 +0100 Subject: [PATCH] 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 --- src/conf/domain_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.47.2