From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Chuan Zheng <zhengchuan@huawei.com>
Cc: yubihong@huawei.com, zhang.zhanghailiang@huawei.com,
quintela@redhat.com, dgilbert@redhat.com, xiexiangyou@huawei.com,
qemu-devel@nongnu.org, alex.chen@huawei.com,
wanghao232@huawei.com
Subject: Re: [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration
Date: Wed, 11 Nov 2020 09:58:43 +0000 [thread overview]
Message-ID: <20201111095843.GC906488@redhat.com> (raw)
In-Reply-To: <1605078858-114607-1-git-send-email-zhengchuan@huawei.com>
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 :|
prev parent reply other threads:[~2020-11-11 9:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201111095843.GC906488@redhat.com \
--to=berrange@redhat.com \
--cc=alex.chen@huawei.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=wanghao232@huawei.com \
--cc=xiexiangyou@huawei.com \
--cc=yubihong@huawei.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhengchuan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).