* [PATCH 4/5 try2] ib/ehca: check idr_find() return value
@ 2008-08-12 13:46 Alexander Schmidt
0 siblings, 0 replies; only message in thread
From: Alexander Schmidt @ 2008-08-12 13:46 UTC (permalink / raw)
To: Roland Dreier, of-ewg, of-general, lkml, linuxppc-dev
Cc: Joachim Fenkes, Stefan Roscher, Christoph Raisch
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>
---
drivers/infiniband/hw/ehca/ehca_reqs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- infiniband.git.orig/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ infiniband.git/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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-12 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-12 13:46 [PATCH 4/5 try2] ib/ehca: check idr_find() return value Alexander Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).