aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_srq.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-09-19 09:17:56 -0700
committerRoland Dreier <rolandd@cisco.com>2005-09-19 09:17:56 -0700
commit6577ae51cf52f5fb0e4a85e673dd7bf2d0074e3e (patch)
tree3c3be701f7954d52f850c116903deb2698bb8038 /drivers/infiniband/hw/mthca/mthca_srq.c
parent[PATCH] IB/mthca: Fix posting work requests to shared receive queues (diff)
downloadlinux-dev-6577ae51cf52f5fb0e4a85e673dd7bf2d0074e3e.tar.xz
linux-dev-6577ae51cf52f5fb0e4a85e673dd7bf2d0074e3e.zip
[PATCH] IB/mthca: Don't try to set srq->last for userspace SRQs
Userspace SRQs don't have a buffer allocated for them in the kernel, so it doesn't make sense to set srq->last during initialization. In fact, this can crash trying to follow a nonexistent buffer pointer. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_srq.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 45dedd2787a4..18998d48c53e 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -172,6 +172,8 @@ static int mthca_alloc_srq_buf(struct mthca_dev *dev, struct mthca_pd *pd,
scatter->lkey = cpu_to_be32(MTHCA_INVAL_LKEY);
}
+ srq->last = get_wqe(srq, srq->max - 1);
+
return 0;
}
@@ -263,7 +265,6 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
srq->first_free = 0;
srq->last_free = srq->max - 1;
- srq->last = get_wqe(srq, srq->max - 1);
return 0;