All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dunrong Huang <riegamaths@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] ui/spice-display: Avoid segment fault when spice is enabled without qxl
Date: Thu,  8 Nov 2012 21:23:16 +0800	[thread overview]
Message-ID: <1352380996-25474-1-git-send-email-riegamaths@gmail.com> (raw)

(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(-)

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)
-- 
1.8.0

             reply	other threads:[~2012-11-08 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 13:23 Dunrong Huang [this message]
2012-11-08 15:15 ` [Qemu-devel] [PATCH] ui/spice-display: Avoid segment fault when spice is enabled without qxl Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352380996-25474-1-git-send-email-riegamaths@gmail.com \
    --to=riegamaths@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.