Skip to content

Commit

Permalink
migration/rdma: Fix a memory issue for migration
Browse files Browse the repository at this point in the history
In commit 3fa9642 change was made to convert the RDMA backend to
accept MigrateAddress struct. However, the assignment of "host" leads
to data corruption on the target host and the failure of migration.

    isock->host = rdma->host;

By allocating the memory explicitly for it with g_strdup_printf(), the
issue is fixed and the migration doesn't fail any more.

Fixes: 3fa9642 ("migration: convert rdma backend to accept MigrateAddress")
Cc: qemu-stable <qemu-stable@nongnu.org>
Cc: Li Zhijian <lizhijian@fujitsu.com>
Link: https://lore.kernel.org/r/CAHEcVy4L_D6tuhJ8h=xLR4WaPaprJE3nnxZAEyUnoTrxQ6CF5w@mail.gmail.com
Signed-off-by: Yu Zhang <yu.zhang@ionos.com>
[peterx: use g_strdup() instead of g_strdup_printf(), per Zhijian]
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
bitterpilz2024 authored and xzpeter committed Mar 11, 2024
1 parent 61dec06 commit 69f7b00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migration/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -3357,7 +3357,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
goto err_rdma_dest_wait;
}

isock->host = rdma->host;
isock->host = g_strdup(rdma->host);
isock->port = g_strdup_printf("%d", rdma->port);

/*
Expand Down

0 comments on commit 69f7b00

Please sign in to comment.