From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Li Zhijian <lizhijian@cn.fujitsu.com>,
quintela@redhat.com, dgilbert@redhat.com, qemu-stable@nongnu.org
Cc: qemu-devel@nongnu.org, Yuval Shaia <yuval.shaia.ml@gmail.com>
Subject: Re: [PATCH] migration/rdma: Fix cm_event used before being initialized
Date: Thu, 13 May 2021 18:45:26 +0200 [thread overview]
Message-ID: <7a538ce7-b224-8993-63b7-934fef4da5d9@redhat.com> (raw)
In-Reply-To: <56d58cef-1ef0-b68e-9ae3-673767a89074@redhat.com>
On 5/13/21 6:13 PM, Philippe Mathieu-Daudé wrote:
> On 5/13/21 1:37 PM, Li Zhijian wrote:
>> A segmentation fault was triggered when i try to abort a postcopy + rdma
>> migration.
>>
>> since rdma_ack_cm_event releases a uninitialized cm_event in thise case.
>>
>> like below:
>> 2496 ret = rdma_get_cm_event(rdma->channel, &cm_event);
>> 2497 if (ret) {
>> 2498 perror("rdma_get_cm_event after rdma_connect");
>> 2499 ERROR(errp, "connecting to destination!");
>> 2500 rdma_ack_cm_event(cm_event); <<<< cause segmentation fault
>> 2501 goto err_rdma_source_connect;
>> 2502 }
>>
>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>> ---
>> migration/rdma.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/migration/rdma.c b/migration/rdma.c
>> index 00eac34232..2dadb62aed 100644
>> --- a/migration/rdma.c
>> +++ b/migration/rdma.c
>> @@ -2466,7 +2466,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
>> .private_data = &cap,
>> .private_data_len = sizeof(cap),
>> };
>> - struct rdma_cm_event *cm_event;
>> + struct rdma_cm_event *cm_event = NULL;
>> int ret;
>>
>> /*
>>
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
Cc: qemu-stable@nongnu.org
next prev parent reply other threads:[~2021-05-13 17:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 11:37 [PATCH] migration/rdma: Fix cm_event used before being initialized Li Zhijian
2021-05-13 16:13 ` Philippe Mathieu-Daudé
2021-05-13 16:45 ` Philippe Mathieu-Daudé [this message]
2021-05-13 17:15 ` Dr. David Alan Gilbert
2021-05-14 1:29 ` lizhijian
2021-05-17 10:00 ` Dr. David Alan Gilbert
2021-05-19 6:40 ` lizhijian
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=7a538ce7-b224-8993-63b7-934fef4da5d9@redhat.com \
--to=philmd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=quintela@redhat.com \
--cc=yuval.shaia.ml@gmail.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).