create_srq is not a mandatory device function, therefore in
userspace/libibverbs/src/verbs.c ibv_create_srq should check
create_srq() first before calling it, otherwise the caller will cause
the segmentation fault on device which doesn't support SRQs.
Signed-off-by: Shirley Ma <xma@us.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
+2005-12-15 Roland Dreier <rdreier@cisco.com>
+
+ * src/verbs.c (ibv_create_srq): Not all provider libraries will
+ support SRQs, so check if the create_srq method is defined before
+ calling it. (Based on a patch from Shirley Ma <xma@us.ibm.com>)
+
2005-11-11 Roland Dreier <roland@cisco.com>
* examples/asyncwatch.c, examples/rc_pingpong.c,
struct ibv_srq *ibv_create_srq(struct ibv_pd *pd,
struct ibv_srq_init_attr *srq_init_attr)
{
- struct ibv_srq *srq = pd->context->ops.create_srq(pd, srq_init_attr);
+ struct ibv_srq *srq;
+ if (!pd->context->ops.create_srq)
+ return NULL;
+
+ srq = pd->context->ops.create_srq(pd, srq_init_attr);
if (srq) {
srq->context = pd->context;
srq->srq_context = srq_init_attr->srq_context;