diff mbox series

[v2] multifd/tls: fix memoryleak of the QIOChannelSocket object when cancelling migration

Message ID 1605104763-118687-1-git-send-email-zhengchuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] multifd/tls: fix memoryleak of the QIOChannelSocket object when cancelling migration | expand

Commit Message

Zheng Chuan Nov. 11, 2020, 2:26 p.m. UTC
When creating new tls client, the tioc->master will be referenced which results in socket
leaking after multifd_save_cleanup if we cancel migration.
Fix it by do object_unref() after tls client creation.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
---
 migration/multifd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel P. Berrangé Nov. 11, 2020, 3:51 p.m. UTC | #1
Note to migration maintainers - this is desirable for 5.2

On Wed, Nov 11, 2020 at 10:26:03PM +0800, Chuan Zheng wrote:
> When creating new tls client, the tioc->master will be referenced which results in socket
> leaking after multifd_save_cleanup if we cancel migration.
> Fix it by do object_unref() after tls client creation.
> 
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
> ---
>  migration/multifd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/migration/multifd.c b/migration/multifd.c
> index 68b171f..6992761 100644
> --- a/migration/multifd.c
> +++ b/migration/multifd.c
> @@ -752,6 +752,7 @@ static void multifd_tls_channel_connect(MultiFDSendParams *p,
>          return;
>      }
>  
> +    object_unref(OBJECT(ioc));
>      trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname);
>      qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing");
>      qio_channel_tls_handshake(tioc,

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
diff mbox series

Patch

diff --git a/migration/multifd.c b/migration/multifd.c
index 68b171f..6992761 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -752,6 +752,7 @@  static void multifd_tls_channel_connect(MultiFDSendParams *p,
         return;
     }
 
+    object_unref(OBJECT(ioc));
     trace_multifd_tls_outgoing_handshake_start(ioc, tioc, hostname);
     qio_channel_set_name(QIO_CHANNEL(tioc), "multifd-tls-outgoing");
     qio_channel_tls_handshake(tioc,