All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Migration+TLS: Fix crash due to double cleanup
@ 2018-04-30 18:59 Dr. David Alan Gilbert (git)
  2018-05-01 10:00 ` Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-04-30 18:59 UTC (permalink / raw)
  To: qemu-devel, pkrempa, berrange; +Cc: quintela, peterx

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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>
---
 migration/channel.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/migration/channel.c b/migration/channel.c
index c5eaf0fa0e..7a32b5aca4 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -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);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-02 12:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 18:59 [Qemu-devel] [PATCH] Migration+TLS: Fix crash due to double cleanup Dr. David Alan Gilbert (git)
2018-05-01 10:00 ` Daniel P. Berrangé
2018-05-01 10:11   ` Daniel P. Berrangé
2018-05-01 10:57     ` Dr. David Alan Gilbert
2018-05-01 11:21       ` Daniel P. Berrangé
2018-05-01 12:51         ` Daniel P. Berrangé
2018-05-02 12:03 ` Peter Krempa
2018-05-02 12:07 ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.