Blame SOURCES/kvm-Migration-TLS-Fix-crash-due-to-double-cleanup.patch

357786
From c70d2938f2acf89ca872061086f1fe26e6c5a69d Mon Sep 17 00:00:00 2001
357786
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
357786
Date: Fri, 22 Jun 2018 19:00:01 +0200
357786
Subject: [PATCH 22/57] Migration+TLS: Fix crash due to double cleanup
357786
MIME-Version: 1.0
357786
Content-Type: text/plain; charset=UTF-8
357786
Content-Transfer-Encoding: 8bit
357786
357786
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
357786
Message-id: <20180622190005.21297-15-dgilbert@redhat.com>
357786
Patchwork-id: 81004
357786
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 14/18] Migration+TLS: Fix crash due to double cleanup
357786
Bugzilla: 1584139
357786
RH-Acked-by: Juan Quintela <quintela@redhat.com>
357786
RH-Acked-by: Peter Xu <peterx@redhat.com>
357786
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
357786
357786
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
357786
357786
During a TLS connect we see:
357786
  migration_channel_connect calls
357786
  migration_tls_channel_connect
357786
  (calls after TLS setup)
357786
  migration_channel_connect
357786
357786
My previous error handling fix made migration_channel_connect
357786
call migrate_fd_connect in all cases; unfortunately the above
357786
means it gets called twice and crashes doing double cleanup.
357786
357786
Fixes: 688a3dcba98
357786
357786
Reported-by: Peter Krempa <pkrempa@redhat.com>
357786
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
357786
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
357786
Message-Id: <20180430185943.35714-1-dgilbert@redhat.com>
357786
Signed-off-by: Juan Quintela <quintela@redhat.com>
357786
(cherry picked from commit 8b7bf2badac25c0a52aff1b181ad75fdb304dd0c)
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 migration/channel.c | 9 +++++++++
357786
 1 file changed, 9 insertions(+)
357786
357786
diff --git a/migration/channel.c b/migration/channel.c
357786
index c5eaf0f..7a32b5a 100644
357786
--- a/migration/channel.c
357786
+++ b/migration/channel.c
357786
@@ -71,6 +71,15 @@ void migration_channel_connect(MigrationState *s,
357786
             !object_dynamic_cast(OBJECT(ioc),
357786
                                  TYPE_QIO_CHANNEL_TLS)) {
357786
             migration_tls_channel_connect(s, ioc, hostname, &error);
357786
+
357786
+            if (!error) {
357786
+                /* tls_channel_connect will call back to this
357786
+                 * function after the TLS handshake,
357786
+                 * so we mustn't call migrate_fd_connect until then
357786
+                 */
357786
+
357786
+                return;
357786
+            }
357786
         } else {
357786
             QEMUFile *f = qemu_fopen_channel_output(ioc);
357786
 
357786
-- 
357786
1.8.3.1
357786