render / rpms / libvirt

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