0a7476
From 408d9e217f05b6c68351804df56aa9c9af7db4e7 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <408d9e217f05b6c68351804df56aa9c9af7db4e7@dist-git>
0a7476
From: Wang Huaqiang <huaqiang.wang@intel.com>
0a7476
Date: Mon, 15 Apr 2019 17:33:01 +0200
0a7476
Subject: [PATCH] conf: Fix bug in finding alloc through matching vcpus
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
The @alloc object returned by virDomainResctrlVcpuMatch is not
0a7476
properly referenced and un-referenced in virDomainCachetuneDefParse.
0a7476
0a7476
This patch fixes this problem.
0a7476
0a7476
Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
0a7476
Reviewed-by: John Ferlan <jferlan@redhat.com>
0a7476
(cherry picked from commit 3a1cdb06fd9bc5e35230f6198e697d6ec03d1206)
0a7476
0a7476
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1468650
0a7476
0a7476
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
0a7476
Message-Id: <7049386040dc0d170193b5fbfc81f2a8335d0063.1555342313.git.phrdina@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
---
0a7476
 src/conf/domain_conf.c | 4 +---
0a7476
 1 file changed, 1 insertion(+), 3 deletions(-)
0a7476
0a7476
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
0a7476
index 74781fe596..6af14cc06f 100644
0a7476
--- a/src/conf/domain_conf.c
0a7476
+++ b/src/conf/domain_conf.c
0a7476
@@ -19089,7 +19089,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def,
0a7476
          * Just updating memory allocation information of that group
0a7476
          */
0a7476
         if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) {
0a7476
-            *alloc = def->resctrls[i]->alloc;
0a7476
+            *alloc = virObjectRef(def->resctrls[i]->alloc);
0a7476
             break;
0a7476
         }
0a7476
         if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
0a7476
@@ -19386,8 +19386,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
0a7476
         if (!alloc)
0a7476
             goto cleanup;
0a7476
         new_alloc = true;
0a7476
-    } else {
0a7476
-        alloc = virObjectRef(alloc);
0a7476
     }
0a7476
 
0a7476
     for (i = 0; i < n; i++) {
0a7476
-- 
0a7476
2.21.0
0a7476