提交 129a10fb 编写于 作者: A Alexander Schmidt 提交者: Roland Dreier

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: NAlexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 17c2b53a
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册