render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From aa0f66af1237656b217f640a9877d5f1aa31cb41 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <aa0f66af1237656b217f640a9877d5f1aa31cb41@dist-git>
c480ed
From: Andrea Bolognani <abologna@redhat.com>
c480ed
Date: Tue, 11 Jun 2019 10:55:06 +0200
c480ed
Subject: [PATCH] qemu: Fix NULL pointer access in qemuProcessInitCpuAffinity()
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
Commit 2f2254c7f4e5 attempted to fix a memory leak by ensuring
c480ed
cpumapToSet is always a freshly allocated bitmap, but regrettably
c480ed
introduced a NULL pointer access while doing so, because it called
c480ed
virBitmapCopy() without allocating the destination bitmap first.
c480ed
c480ed
Solve the issue by using virBitmapNewCopy() instead.
c480ed
c480ed
Reported-by: John Ferlan <jferlan@redhat.com>
c480ed
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c480ed
Reviewed-by: Erik Skultety <eskultet@redhat.com>
c480ed
Reviewed-by: John Ferlan <jferlan@redhat.com>
c480ed
(cherry picked from commit a84922c09e9e1a0ca4f8fb1e8b4b1c7b55bd79e9)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1716908
c480ed
c480ed
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c480ed
Message-Id: <20190611085506.12564-7-abologna@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/qemu/qemu_process.c | 2 +-
c480ed
 1 file changed, 1 insertion(+), 1 deletion(-)
c480ed
c480ed
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
c480ed
index d0945b9c65..c220accfaf 100644
c480ed
--- a/src/qemu/qemu_process.c
c480ed
+++ b/src/qemu/qemu_process.c
c480ed
@@ -2391,7 +2391,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
c480ed
         if (virNumaNodesetToCPUset(nodeset, &cpumapToSet) < 0)
c480ed
             return -1;
c480ed
     } else if (vm->def->cputune.emulatorpin) {
c480ed
-        if (virBitmapCopy(cpumapToSet, vm->def->cputune.emulatorpin) < 0)
c480ed
+        if (!(cpumapToSet = virBitmapNewCopy(vm->def->cputune.emulatorpin)))
c480ed
             return -1;
c480ed
     } else {
c480ed
         if (qemuProcessGetAllCpuAffinity(&cpumapToSet) < 0)
c480ed
-- 
c480ed
2.22.0
c480ed