* [PATCH v2] migration/rdma: Fix cm_event used before being initialized
@ 2021-05-19 6:47 Li Zhijian
2021-05-19 8:11 ` Dr. David Alan Gilbert
2021-05-26 11:26 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 3+ messages in thread
From: Li Zhijian @ 2021-05-19 6:47 UTC (permalink / raw)
To: quintela, dgilbert; +Cc: qemu-devel, Li Zhijian
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 these 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 }
Refer to the rdma_get_cm_event() code, cm_event will be
updated/changed only if rdma_get_cm_event() returns 0. So it's okey to
remove the ack in error patch.
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
V2: remove ack from the error patch (Dave)
---
migration/rdma.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 00eac34232..41726cc74a 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2497,7 +2497,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
if (ret) {
perror("rdma_get_cm_event after rdma_connect");
ERROR(errp, "connecting to destination!");
- rdma_ack_cm_event(cm_event);
goto err_rdma_source_connect;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] migration/rdma: Fix cm_event used before being initialized
2021-05-19 6:47 [PATCH v2] migration/rdma: Fix cm_event used before being initialized Li Zhijian
@ 2021-05-19 8:11 ` Dr. David Alan Gilbert
2021-05-26 11:26 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2021-05-19 8:11 UTC (permalink / raw)
To: Li Zhijian; +Cc: qemu-devel, quintela
* Li Zhijian (lizhijian@cn.fujitsu.com) 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 these 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 }
>
> Refer to the rdma_get_cm_event() code, cm_event will be
> updated/changed only if rdma_get_cm_event() returns 0. So it's okey to
> remove the ack in error patch.
>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Thanks!
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> V2: remove ack from the error patch (Dave)
> ---
> migration/rdma.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 00eac34232..41726cc74a 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -2497,7 +2497,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
> if (ret) {
> perror("rdma_get_cm_event after rdma_connect");
> ERROR(errp, "connecting to destination!");
> - rdma_ack_cm_event(cm_event);
> goto err_rdma_source_connect;
> }
>
> --
> 2.30.2
>
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] migration/rdma: Fix cm_event used before being initialized
2021-05-19 6:47 [PATCH v2] migration/rdma: Fix cm_event used before being initialized Li Zhijian
2021-05-19 8:11 ` Dr. David Alan Gilbert
@ 2021-05-26 11:26 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2021-05-26 11:26 UTC (permalink / raw)
To: Li Zhijian; +Cc: qemu-devel, quintela
* Li Zhijian (lizhijian@cn.fujitsu.com) 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 these 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 }
>
> Refer to the rdma_get_cm_event() code, cm_event will be
> updated/changed only if rdma_get_cm_event() returns 0. So it's okey to
> remove the ack in error patch.
>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Queued
> ---
> V2: remove ack from the error patch (Dave)
> ---
> migration/rdma.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 00eac34232..41726cc74a 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -2497,7 +2497,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
> if (ret) {
> perror("rdma_get_cm_event after rdma_connect");
> ERROR(errp, "connecting to destination!");
> - rdma_ack_cm_event(cm_event);
> goto err_rdma_source_connect;
> }
>
> --
> 2.30.2
>
>
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-26 11:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 6:47 [PATCH v2] migration/rdma: Fix cm_event used before being initialized Li Zhijian
2021-05-19 8:11 ` Dr. David Alan Gilbert
2021-05-26 11:26 ` Dr. David Alan Gilbert
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).