render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
27b6f9
From 9c5bfad7725766860abf41d47a55f6fbdd9130bb Mon Sep 17 00:00:00 2001
27b6f9
Message-Id: <9c5bfad7725766860abf41d47a55f6fbdd9130bb@dist-git>
27b6f9
From: Michal Privoznik <mprivozn@redhat.com>
27b6f9
Date: Wed, 14 Mar 2018 08:18:43 +0100
27b6f9
Subject: [PATCH] virDomainDeviceValidateAliasForHotplug: Use correct domain
27b6f9
 defintion
27b6f9
27b6f9
RHEL-7.6: https://bugzilla.redhat.com/show_bug.cgi?id=1543775
27b6f9
RHEL-7.5.z: https://bugzilla.redhat.com/show_bug.cgi?id=1554928
27b6f9
27b6f9
For some weird reason this function is getting live and
27b6f9
persistent def for domain but then accesses vm->def and
27b6f9
vm->newDef directly. This is rather unsafe as we can be
27b6f9
accessing NULL pointer.
27b6f9
27b6f9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
27b6f9
(cherry picked from commit e5673ed44465edcfccdd906158136ad8dcb94b9b)
27b6f9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
27b6f9
---
27b6f9
 src/conf/domain_conf.c | 4 ++--
27b6f9
 1 file changed, 2 insertions(+), 2 deletions(-)
27b6f9
27b6f9
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
27b6f9
index 1a3db4a7be..c746ab19cd 100644
27b6f9
--- a/src/conf/domain_conf.c
27b6f9
+++ b/src/conf/domain_conf.c
27b6f9
@@ -5666,11 +5666,11 @@ virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
27b6f9
         return -1;
27b6f9
 
27b6f9
     if (persDef &&
27b6f9
-        virDomainDeviceValidateAliasImpl(vm->def, dev) < 0)
27b6f9
+        virDomainDeviceValidateAliasImpl(persDef, dev) < 0)
27b6f9
         return -1;
27b6f9
 
27b6f9
     if (liveDef &&
27b6f9
-        virDomainDeviceValidateAliasImpl(vm->newDef, dev) < 0)
27b6f9
+        virDomainDeviceValidateAliasImpl(liveDef, dev) < 0)
27b6f9
         return -1;
27b6f9
 
27b6f9
     return 0;
27b6f9
-- 
27b6f9
2.16.2
27b6f9