Skip to contentSkip to conversation

qxl: fix local renderer crash

PATCH In review Gerd Hoffmann 2 participants 2 messages Apr 27, 2018 – May 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qxl: fix local renderer crash

Make sure we only ask the spice local renderer for display updates in case we have a valid primary surface. Without that spice is confused and throws errors in case a display update request (triggered by screendump for example) happens in parallel to a mode switch and hits the race window where the old primary surface is gone and the new isn't establisted yet.

---
 hw/display/qxl-render.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/display/qxl-render.c +2 -1
index e7ac4f8789..c62b9a5e75 100644
@@ -169,7 +169,8 @@ void qxl_render_update(PCIQXLDevice *qxl)
 
     qemu_mutex_lock(&qxl->ssd.lock);
 
-    if (!runstate_is_running() || !qxl->guest_primary.commands) {
+    if (!runstate_is_running() || !qxl->guest_primary.commands ||
+        qxl->mode == QXL_MODE_UNDEFINED) {
         qxl_render_update_area_unlocked(qxl);
         qemu_mutex_unlock(&qxl->ssd.lock);
         return;
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 9 lines · Gerd Hoffmann

Make sure we only ask the spice local renderer for display updates in case we have a valid primary surface. Without that spice is confused and throws errors in case a display update request (triggered by screendump for example) happens in parallel to a mode switch and hits the race window where the old primary surface is gone and the new isn't establisted yet.

Because the update message is handled asynchronously by the spice worker thread, I wonder if it shouldn't be ignored by spice instead if the display state is invalid/undefined.

But this patch seems reasonable too:

Quoted 22 lines
---
 hw/display/qxl-render.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/display/qxl-render.c +2 -2
index e7ac4f8789..c62b9a5e75 100644
@@ -169,7 +169,8 @@ void qxl_render_update(PCIQXLDevice *qxl)
 
     qemu_mutex_lock(&qxl->ssd.lock);
 
-    if (!runstate_is_running() || !qxl->guest_primary.commands) {
+    if (!runstate_is_running() || !qxl->guest_primary.commands ||
+        qxl->mode == QXL_MODE_UNDEFINED) {
         qxl_render_update_area_unlocked(qxl);
         qemu_mutex_unlock(&qxl->ssd.lock);
         return;
--

2.9.3

Signature · 1 line
Marc-André Lureau