Skip to content

Commit

Permalink
migration: Check that postcopy fd's are not NULL
Browse files Browse the repository at this point in the history
If postcopy has finished, it frees the array.
But vhost-user unregister it at cleanup time.

fixes: c4f7538
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  • Loading branch information
Juan Quintela committed Nov 6, 2021
1 parent c39deb2 commit 5655998
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions migration/postcopy-ram.c
Expand Up @@ -1457,6 +1457,10 @@ void postcopy_unregister_shared_ufd(struct PostCopyFD *pcfd)
MigrationIncomingState *mis = migration_incoming_get_current();
GArray *pcrfds = mis->postcopy_remote_fds;

if (!pcrfds) {
/* migration has already finished and freed the array */
return;
}
for (i = 0; i < pcrfds->len; i++) {
struct PostCopyFD *cur = &g_array_index(pcrfds, struct PostCopyFD, i);
if (cur->fd == pcfd->fd) {
Expand Down

0 comments on commit 5655998

Please sign in to comment.