* [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration
@ 2020-11-11 7:14 Chuan Zheng
2020-11-11 9:58 ` Daniel P. Berrangé
0 siblings, 1 reply; 2+ messages in thread
From: Chuan Zheng @ 2020-11-11 7:14 UTC (permalink / raw)
To: quintela, dgilbert, berrange
Cc: yubihong, zhang.zhanghailiang, qemu-devel, xiexiangyou,
alex.chen, wanghao232
When creating new tls client, the tioc->master will be referenced, we need dereferenced
it after tls handshake.
Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
---
migration/multifd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/migration/multifd.c b/migration/multifd.c
index 68b171f..df76a8e 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -728,7 +728,8 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
gpointer opaque)
{
MultiFDSendParams *p = opaque;
- QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
+ QIOChannelTLS *tioc = QIO_CHANNEL_TLS(qio_task_get_source(task));
+ QIOChannel *ioc = QIO_CHANNEL(tioc);
Error *err = NULL;
if (qio_task_propagate_error(task, &err)) {
@@ -737,6 +738,7 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
trace_multifd_tls_outgoing_handshake_complete(ioc);
}
multifd_channel_connect(p, ioc, err);
+ object_unref(OBJECT(tioc->master));
}
static void multifd_tls_channel_connect(MultiFDSendParams *p,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration
2020-11-11 7:14 [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration Chuan Zheng
@ 2020-11-11 9:58 ` Daniel P. Berrangé
0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2020-11-11 9:58 UTC (permalink / raw)
To: Chuan Zheng
Cc: yubihong, zhang.zhanghailiang, quintela, dgilbert, xiexiangyou,
qemu-devel, alex.chen, wanghao232
On Wed, Nov 11, 2020 at 03:14:18PM +0800, Chuan Zheng wrote:
> When creating new tls client, the tioc->master will be referenced, we need dereferenced
> it after tls handshake.
>
> Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
> ---
> migration/multifd.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/migration/multifd.c b/migration/multifd.c
> index 68b171f..df76a8e 100644
> --- a/migration/multifd.c
> +++ b/migration/multifd.c
> @@ -728,7 +728,8 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
> gpointer opaque)
> {
> MultiFDSendParams *p = opaque;
> - QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
> + QIOChannelTLS *tioc = QIO_CHANNEL_TLS(qio_task_get_source(task));
> + QIOChannel *ioc = QIO_CHANNEL(tioc);
> Error *err = NULL;
>
> if (qio_task_propagate_error(task, &err)) {
> @@ -737,6 +738,7 @@ static void multifd_tls_outgoing_handshake(QIOTask *task,
> trace_multifd_tls_outgoing_handshake_complete(ioc);
> }
> multifd_channel_connect(p, ioc, err);
> + object_unref(OBJECT(tioc->master));
> }
I think this should be done earlier, at the time where we wrap the channel.
eg in multifd_tls_channel_connect(), immediately after the call to
migration_tls_client_create, as that's where the double reference starts
from.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-11 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 7:14 [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration Chuan Zheng
2020-11-11 9:58 ` 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.