Blame SOURCES/libvirt-qemu-monitor-Don-t-bother-extracting-vCPU-halted-state-in-text-monitor.patch

3e5111
From 3dfdc7e73f15216b0a9ef5858329c4daf3142ed5 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <3dfdc7e73f15216b0a9ef5858329c4daf3142ed5@dist-git>
3e5111
From: Peter Krempa <pkrempa@redhat.com>
3e5111
Date: Fri, 19 May 2017 09:44:14 +0200
3e5111
Subject: [PATCH] qemu: monitor: Don't bother extracting vCPU halted state in
3e5111
 text monitor
3e5111
3e5111
The code causes the 'offset' variable to be overwritten (possibly with
3e5111
NULL if neither of the vCPUs is halted) which causes a crash since the
3e5111
variable is still used after that part.
3e5111
3e5111
Additionally there's a bug, since strstr() would look up the '(halted)'
3e5111
string in the whole string rather than just the currently processed line
3e5111
the returned data is completely bogus.
3e5111
3e5111
Rather than switching to single line parsing let's remove the code
3e5111
altogether since it has a commonly used JSON monitor alternative and
3e5111
the data itself is not very useful to report.
3e5111
3e5111
The code was introduced in commit cc5e695bde
3e5111
3e5111
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452106
3e5111
(cherry picked from commit 6ff99e95771bb33531ea6733a823bc6a30158256)
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_monitor_text.c | 6 ------
3e5111
 1 file changed, 6 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
3e5111
index 9c9eeea01..66c94fbcd 100644
3e5111
--- a/src/qemu/qemu_monitor_text.c
3e5111
+++ b/src/qemu/qemu_monitor_text.c
3e5111
@@ -552,12 +552,6 @@ qemuMonitorTextQueryCPUs(qemuMonitorPtr mon,
3e5111
         cpu.qemu_id = cpuid;
3e5111
         cpu.tid = tid;
3e5111
 
3e5111
-        /* Extract halted indicator */
3e5111
-        if ((offset = strstr(line, "(halted)")) != NULL)
3e5111
-            cpu.halted = true;
3e5111
-        else
3e5111
-            cpu.halted = false;
3e5111
-
3e5111
         if (VIR_APPEND_ELEMENT_COPY(cpus, ncpus, cpu) < 0) {
3e5111
             ret = -1;
3e5111
             goto cleanup;
3e5111
-- 
3e5111
2.13.0
3e5111