IB/ehca: Check idr_find() return value

The idr_find() function may fail when trying to get the QP that is
associated with a CQE, e.g. when a QP has been destroyed between the
generation of a CQE and the poll request for it. In consequence, the
return value of idr_find() must be checked and the CQE must be
discarded when the QP cannot be found.

Signed-off-by: Alexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by Alexander Schmidt and committed by Roland Dreier 129a10fb 17c2b53a

+3 -1
+3 -1
drivers/infiniband/hw/ehca/ehca_reqs.c
··· 680 680 681 681 read_lock(&ehca_qp_idr_lock); 682 682 my_qp = idr_find(&ehca_qp_idr, cqe->qp_token); 683 - wc->qp = &my_qp->ib_qp; 684 683 read_unlock(&ehca_qp_idr_lock); 684 + if (!my_qp) 685 + goto repoll; 686 + wc->qp = &my_qp->ib_qp; 685 687 686 688 wc->byte_len = cqe->nr_bytes_transferred; 687 689 wc->pkey_index = cqe->pkey_index;