[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080812144946.5e2499f8@BL3D1974.boeblingen.de.ibm.com>
Date: Tue, 12 Aug 2008 14:49:46 +0200
From: Alexander Schmidt <alexs@...ux.vnet.ibm.com>
To: linuxppc-dev <linuxppc-dev@...abs.org>,
lkml <linux-kernel@...r.kernel.org>,
of-ewg <ewg@...ts.openfabrics.org>,
of-general <general@...ts.openfabrics.org>,
Roland Dreier <rolandd@...co.com>
Cc: Christoph Raisch <raisch@...ibm.com>,
Hoang-Nam Nguyen <HNGUYEN@...ibm.com>,
Joachim Fenkes <fenkes@...ibm.com>,
Stefan Roscher <stefan.roscher@...ibm.com>
Subject: [PATCH 4/5] 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@...ux.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists