From aa5367b5e81cdc3cc3dc8dbc31daef6acecc1f97 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 7 Mar 2019 12:26:22 +0000 Subject: [PATCH 2/2] migration/rdma: Fix qemu_rdma_cleanup null check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Dr. David Alan Gilbert Message-id: <20190307122622.9387-3-dgilbert@redhat.com> Patchwork-id: 84819 O-Subject: [RHEL-8.0 qemu-kvm AV PATCH 2/2] migration/rdma: Fix qemu_rdma_cleanup null check Bugzilla: 1608649 RH-Acked-by: Laurent Vivier RH-Acked-by: Peter Xu RH-Acked-by: Pankaj Gupta From: "Dr. David Alan Gilbert" If the migration fails before the channel is open (e.g. a bad address) we end up in the cleanup with rdma->channel==NULL. Spotted by Coverity: CID 1398634 Fixes: fbbaacab2758cb3f32a0 Signed-off-by: Dr. David Alan Gilbert Message-Id: <20190214185351.5927-1-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé (cherry picked from commit cf75e2684938413f0bbe95f5a4b7db5c845e42c8) Signed-off-by: Danilo C. L. de Paula --- migration/rdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 54a3c11..9fa3b17 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2321,7 +2321,9 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) rdma->connected = false; } - qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL); + if (rdma->channel) { + qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL); + } g_free(rdma->dest_blocks); rdma->dest_blocks = NULL; -- 1.8.3.1