summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Schmidt <alexs@linux.vnet.ibm.com>2008-08-12 13:46:27 (GMT)
committerRoland Dreier <rolandd@cisco.com>2008-08-12 18:34:59 (GMT)
commit129a10fb81309f455eeb444560ec38657d29c46f (patch)
tree544d44f33452e74b86a0869d5d5c64a503ba872b
parent17c2b53adbf1ebd7a8b6a63e2597199676426dbf (diff)
downloadlinux-fsl-qoriq-129a10fb81309f455eeb444560ec38657d29c46f.tar.xz
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>
-rw-r--r--drivers/infiniband/hw/ehca/ehca_reqs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c
index acb8649..cea3eba 100644
--- a/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ b/drivers/infiniband/hw/ehca/ehca_reqs.c
@@ -680,8 +680,10 @@ repoll:
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;