[Spice-devel,v2,01/12] spice: init dcl before registering qxl interface

Submitted by Gerd Hoffmann on Feb. 19, 2016, 9:14 a.m.

Details

Message ID 1455873289-349-2-git-send-email-kraxel@redhat.com
State New
Headers show
Series "spice: add opengl/virgl/dmabuf support" ( rev: 2 ) in Spice

Not browsing as part of any series.

Commit Message

Gerd Hoffmann Feb. 19, 2016, 9:14 a.m.
Without this spice might callback into qemu before ssd->dcl.con is
initialized, resulting in a segfault due to NULL pointer dereference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 8a5b325..cdbc78d 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -775,14 +775,14 @@  static void qemu_spice_display_init_one(QemuConsole *con)
 
     qemu_spice_display_init_common(ssd);
 
+    ssd->dcl.ops = &display_listener_ops;
+    ssd->dcl.con = con;
+
     ssd->qxl.base.sif = &dpy_interface.base;
     qemu_spice_add_display_interface(&ssd->qxl, con);
     assert(ssd->worker);
-
     qemu_spice_create_host_memslot(ssd);
 
-    ssd->dcl.ops = &display_listener_ops;
-    ssd->dcl.con = con;
     register_displaychangelistener(&ssd->dcl);
 }
 

Comments

Hi

On Fri, Feb 19, 2016 at 10:14 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Without this spice might callback into qemu before ssd->dcl.con is
> initialized, resulting in a segfault due to NULL pointer dereference.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>