summaryrefslogtreecommitdiffstats
path: root/server/red_worker.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2011-07-04 15:14:43 +0300
committerYonit Halperin <yhalperi@redhat.com>2011-07-05 17:23:38 +0300
commitb881c4b5caa42544d449e3454a00250f7cd023c0 (patch)
treedb405765a92e0b2f4c10a167dfb823c369e3b3fd /server/red_worker.c
parent3d3066b175ee2dec8e73c8c56f418a6ae98b1c26 (diff)
downloadspice-b881c4b5caa42544d449e3454a00250f7cd023c0.tar.gz
spice-b881c4b5caa42544d449e3454a00250f7cd023c0.tar.xz
spice-b881c4b5caa42544d449e3454a00250f7cd023c0.zip
server: not reading command rings before RED_WORKER_MESSAGE_START, RHBZ #718713
On migration, destroy_surfaces is called from qxl (qxl_hard_reset), before the device was loaded (on destination). handle_dev_destroy_surfaces led to red_process_commands, which read the qxl command ring (which appeared to be not empty), and then when processing the command it accessed unmapped memory.
Diffstat (limited to 'server/red_worker.c')
-rw-r--r--server/red_worker.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index e00751c8..7632c604 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4166,6 +4166,11 @@ static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ri
QXLCommandExt ext_cmd;
int n = 0;
+ if (!worker->running) {
+ *ring_is_empty = TRUE;
+ return n;
+ }
+
*ring_is_empty = FALSE;
while (!worker->cursor_channel || worker->cursor_channel->common.base.pipe_size <= max_pipe_size) {
if (!worker->qxl->st->qif->get_cursor_command(worker->qxl, &ext_cmd)) {
@@ -4205,7 +4210,12 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
QXLCommandExt ext_cmd;
int n = 0;
uint64_t start = red_now();
-
+
+ if (!worker->running) {
+ *ring_is_empty = TRUE;
+ return n;
+ }
+
*ring_is_empty = FALSE;
while (!worker->display_channel || worker->display_channel->common.base.pipe_size <= max_pipe_size) {
if (!worker->qxl->st->qif->get_command(worker->qxl, &ext_cmd)) {