aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@dev.mellanox.co.il>2007-05-02 08:31:12 -0400
committerRoland Dreier <rolandd@cisco.com>2007-05-07 00:18:11 -0400
commitd6ef7d68f6f51c5b9de01c542dab8b90067a9c27 (patch)
tree9121e758ef948defe37c7d960bcc422fe37aea0f
parentaff9e39d97585486764572ab2f3bf5dfce18c660 (diff)
IPoIB/cm: Don't crash if remote side uses one QP for both directions
The IPoIB CM spec allows the use of a single connection in both active->passive and passive->active directions. The current Linux code uses one connection for both directions, but if another node only uses one connection for both directions, we oops when we try to look up the passive connection. Fix by checking that qp_context is non-NULL before dereferencing it. Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 76717410660e..1e27930077e6 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -370,7 +370,7 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
370 370
371 if (!likely(wr_id & IPOIB_CM_RX_UPDATE_MASK)) { 371 if (!likely(wr_id & IPOIB_CM_RX_UPDATE_MASK)) {
372 p = wc->qp->qp_context; 372 p = wc->qp->qp_context;
373 if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) { 373 if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) {
374 spin_lock_irqsave(&priv->lock, flags); 374 spin_lock_irqsave(&priv->lock, flags);
375 p->jiffies = jiffies; 375 p->jiffies = jiffies;
376 /* Move this entry to list head, but do 376 /* Move this entry to list head, but do