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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to