diff mbox

ui/spice-display: Avoid segment fault when spice is enabled without qxl

Message ID 1352380996-25474-1-git-send-email-riegamaths@gmail.com
State New
Headers show

Commit Message

dunrong huang Nov. 8, 2012, 1:23 p.m. UTC
(gdb) r -enable-kvm -m 512 -spice port=5900,addr=0.0.0.0,disable-ticketing ArchLinux.img
Starting program: /root/usr/bin/qemu-system-x86_64 -enable-kvm -m 512 -spice port=5900,addr=0.0.0.0,disable-ticketing ArchLinux.img
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffeed93700 (LWP 23838)]
[New Thread 0x7fffee391700 (LWP 23839)]

Program received signal SIGSEGV, Segmentation fault.
0x00005555557df97d in qemu_spice_destroy_primary_surface (ssd=0x55555611ca80,
    id=0, async=QXL_SYNC) at ui/spice-display.c:119
119	        ssd->worker->destroy_primary_surface(ssd->worker, id);
(gdb) bt
    ssd=0x55555611ca80, id=0, async=QXL_SYNC) at ui/spice-display.c:119
    at ui/spice-display.c:343
    at ui/spice-display.c:397
    at ui/spice-display.c:566
    dcl=0x555555cdb040) at ./console.h:218
    at ui/spice-display.c:585
    envp=0x7fffffffda18) at vl.c:3902
(gdb) p ssd->worker
$1 = (QXLWorker *) 0x0
...
...

Before qemu_spice_add_interface() was called, sdpy.worker was
not be initialized yet, in this case, segment fault occurred
while qemu_spice_display_resize() was called.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
---
 ui/spice-display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Gerd Hoffmann Nov. 8, 2012, 3:15 p.m. UTC | #1
> Before qemu_spice_add_interface() was called, sdpy.worker was
> not be initialized yet, in this case, segment fault occurred
> while qemu_spice_display_resize() was called.

Pending spice pull req fixes it in another way, patch is here:

http://patchwork.ozlabs.org/patch/196518/

cheers,
 Gerd
diff mbox

Patch

diff --git a/ui/spice-display.c b/ui/spice-display.c
index fb99148..b256caa 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -562,7 +562,9 @@  static void display_update(struct DisplayState *ds, int x, int y, int w, int h)
 
 static void display_resize(struct DisplayState *ds)
 {
-    qemu_spice_display_resize(&sdpy);
+    if (sdpy.worker) {
+        qemu_spice_display_resize(&sdpy);
+    }
 }
 
 static void display_refresh(struct DisplayState *ds)