aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Zhijian <lizhijian@cn.fujitsu.com>2021-05-19 14:47:40 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2021-05-26 18:39:32 +0100
commitefb208dc9c3f1e881aecff21fb1c7a7b6b869480 (patch)
tree949af78ec3613c7db4cfeb7b0a6bab47f95f93e8
parentbf99f30bc3420f2f4b82f7f827fb93197d33c017 (diff)
migration/rdma: Fix cm_event used before being initialized
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> Message-Id: <20210519064740.10828-1-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r--migration/rdma.c1
1 files changed, 0 insertions, 1 deletions
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;
}