Skip to content

Commit

Permalink
[PATCH] IB/mthca: Don't try to set srq->last for userspace SRQs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roland Dreier committed Sep 19, 2005
1 parent 3853194 commit 6577ae5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/hw/mthca/mthca_srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 6577ae5

Please sign in to comment.