]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Migration+TLS: Fix crash due to double cleanup
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 30 Apr 2018 18:59:43 +0000 (19:59 +0100)
committerJuan Quintela <quintela@redhat.com>
Tue, 15 May 2018 20:13:08 +0000 (22:13 +0200)
During a TLS connect we see:
  migration_channel_connect calls
  migration_tls_channel_connect
  (calls after TLS setup)
  migration_channel_connect

My previous error handling fix made migration_channel_connect
call migrate_fd_connect in all cases; unfortunately the above
means it gets called twice and crashes doing double cleanup.

Fixes: 688a3dcba98
Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180430185943.35714-1-dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/channel.c

index 716192bf7528a8ee8f894e8072eb134a42057204..33e0e9b82f9fdbb7027061bb9833cd1b9517ec50 100644 (file)
@@ -71,6 +71,15 @@ void migration_channel_connect(MigrationState *s,
             !object_dynamic_cast(OBJECT(ioc),
                                  TYPE_QIO_CHANNEL_TLS)) {
             migration_tls_channel_connect(s, ioc, hostname, &error);
+
+            if (!error) {
+                /* tls_channel_connect will call back to this
+                 * function after the TLS handshake,
+                 * so we mustn't call migrate_fd_connect until then
+                 */
+
+                return;
+            }
         } else {
             QEMUFile *f = qemu_fopen_channel_output(ioc);