hw/rdma: Fix possible usage of a NULL pointer
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>
This commit is contained in:
		
							parent
							
								
									1bad4957c8
								
							
						
					
					
						commit
						b0197cf80a
					
				@ -216,6 +216,7 @@ void pvrdma_cq_poll(RdmaDeviceResources *dev_res, uint32_t cq_handle)
 | 
				
			|||||||
    cq = rdma_rm_get_cq(dev_res, cq_handle);
 | 
					    cq = rdma_rm_get_cq(dev_res, cq_handle);
 | 
				
			||||||
    if (!cq) {
 | 
					    if (!cq) {
 | 
				
			||||||
        pr_dbg("Invalid CQ# %d\n", cq_handle);
 | 
					        pr_dbg("Invalid CQ# %d\n", cq_handle);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rdma_backend_poll_cq(dev_res, &cq->backend_cq);
 | 
					    rdma_backend_poll_cq(dev_res, &cq->backend_cq);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user