]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/rdma: Fix possible usage of a NULL pointer
authorMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
Mon, 30 Apr 2018 20:02:18 +0000 (23:02 +0300)
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
Thu, 3 May 2018 17:52:29 +0000 (20:52 +0300)
Coverity CID 1390586; The cq handle is provided by the guest
and cannot be trusted to be previuosly allocated.
Fix it by exiting the completion flow.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Message-Id: <20180430200223.4119-3-marcel.apfelbaum@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/rdma/vmw/pvrdma_qp_ops.c

index 750ade6c3153e28f3d4bf784beafac31ed7e3f6d..99bb51111e7369a0be19217e04428b7722fc6a14 100644 (file)
@@ -216,6 +216,7 @@ void pvrdma_cq_poll(RdmaDeviceResources *dev_res, uint32_t cq_handle)
     cq = rdma_rm_get_cq(dev_res, cq_handle);
     if (!cq) {
         pr_dbg("Invalid CQ# %d\n", cq_handle);
+        return;
     }
 
     rdma_backend_poll_cq(dev_res, &cq->backend_cq);