svn commit: r349196 - head/usr.sbin/bhyve

Mark Johnston markj at FreeBSD.org
Wed Jun 19 16:09:21 UTC 2019


Author: markj
Date: Wed Jun 19 16:09:20 2019
New Revision: 349196
URL: https://svnweb.freebsd.org/changeset/base/349196

Log:
  Make zlib encoding messages idempotent.
  
  Otherwise duplicate messages can trigger a reinitialization of the
  compression stream while the update thread is running.  Also ensure
  that the stream is initialized before the update thread may attempt
  to use it.
  
  PR:		238333
  Reviewed by:	cem, rgrimes
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20673

Modified:
  head/usr.sbin/bhyve/rfb.c

Modified: head/usr.sbin/bhyve/rfb.c
==============================================================================
--- head/usr.sbin/bhyve/rfb.c	Wed Jun 19 15:36:02 2019	(r349195)
+++ head/usr.sbin/bhyve/rfb.c	Wed Jun 19 16:09:20 2019	(r349196)
@@ -273,8 +273,10 @@ rfb_recv_set_encodings_msg(struct rfb_softc *rc, int c
 			rc->enc_raw_ok = true;
 			break;
 		case RFB_ENCODING_ZLIB:
-			rc->enc_zlib_ok = true;
-			deflateInit(&rc->zstream, Z_BEST_SPEED);
+			if (!rc->enc_zlib_ok) {
+				deflateInit(&rc->zstream, Z_BEST_SPEED);
+				rc->enc_zlib_ok = true;
+			}
 			break;
 		case RFB_ENCODING_RESIZE:
 			rc->enc_resize_ok = true;


More information about the svn-src-head mailing list