render / rpms / libvirt

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