Skip to content

Commit

Permalink
IB/ehca: Check idr_find() return value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Schmidt authored and Roland Dreier committed Aug 12, 2008
1 parent 17c2b53 commit 129a10f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/infiniband/hw/ehca/ehca_reqs.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,10 @@ static inline int ehca_poll_cq_one(struct ib_cq *cq, struct ib_wc *wc)

read_lock(&ehca_qp_idr_lock);
my_qp = idr_find(&ehca_qp_idr, cqe->qp_token);
wc->qp = &my_qp->ib_qp;
read_unlock(&ehca_qp_idr_lock);
if (!my_qp)
goto repoll;
wc->qp = &my_qp->ib_qp;

wc->byte_len = cqe->nr_bytes_transferred;
wc->pkey_index = cqe->pkey_index;
Expand Down

0 comments on commit 129a10f

Please sign in to comment.