RDMA: Check attr_mask during modify_qp
[linux-2.6-block.git] / drivers / infiniband / hw / cxgb4 / qp.c
index cbddb20c61216e2facea737301c3edb9e46e9f47..79e69d449b074809a12c8d906eac859f42c80b36 100644 (file)
@@ -2374,6 +2374,9 @@ int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
        pr_debug("ib_qp %p\n", ibqp);
 
+       if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+               return -EOPNOTSUPP;
+
        /* iwarp does not support the RTR state */
        if ((attr_mask & IB_QP_STATE) && (attr->qp_state == IB_QPS_RTR))
                attr_mask &= ~IB_QP_STATE;
@@ -2680,6 +2683,9 @@ int c4iw_create_srq(struct ib_srq *ib_srq, struct ib_srq_init_attr *attrs,
        int ret;
        int wr_len;
 
+       if (attrs->srq_type != IB_SRQT_BASIC)
+               return -EOPNOTSUPP;
+
        pr_debug("%s ib_pd %p\n", __func__, pd);
 
        php = to_c4iw_pd(pd);
@@ -2797,7 +2803,7 @@ err_free_wr_wait:
        return ret;
 }
 
-void c4iw_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
+int c4iw_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
 {
        struct c4iw_dev *rhp;
        struct c4iw_srq *srq;
@@ -2813,4 +2819,5 @@ void c4iw_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
                       srq->wr_waitp);
        c4iw_free_srq_idx(&rhp->rdev, srq->idx);
        c4iw_put_wr_wait(srq->wr_waitp);
+       return 0;
 }