Patchwork Reverse VNC connections: Avoid segmentation fault.

login
register
mail settings
Submitter Eddie Kohler
Date Sept. 29, 2010, 7:05 p.m.
Message ID <4CA38E0B.5090504@cs.ucla.edu>
Download mbox | patch
Permalink /patch/66090/
State New
Headers show

Comments

Eddie Kohler - Sept. 29, 2010, 7:05 p.m.
Hi

-vnc HOST:PORT,reverse connections are currently broken, because
vnc_refresh_server_surface is called before the guest is actually
available.  The following patch fixes reverse connections.

Eddie

From 32fe1bc61ee9f2f1a8220642a48acb05b5be7322 Mon Sep 17 00:00:00 2001
From: Eddie Kohler <ekohler@gmail.com>
Date: Wed, 29 Sep 2010 12:00:55 -0700
Subject: [PATCH] Reverse VNC connections: Avoid segmentation fault.

---
 ui/vnc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index c7a1831..8c3af8a 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2261,6 +2261,10 @@  static int vnc_refresh_server_surface(VncDisplay *vd)
     VncState *vs;
     int has_dirty = 0;
 
+    /* On reverse connections, the guest might not be connected yet. */
+    if (!vd->guest.ds)
+       return 0;
+
     /*
      * Walk through the guest dirty map.
      * Check and copy modified bits from guest to server surface.