Add a simple check to rdma_create_qp() to see if a QP has already been
associated with an rdma_cm_id. Otherwise a user can allocate a
second QP with an ID, with the reference to the first QP replaced
by the second allocation.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
exposed to the user through the rdma_cm_id structure.
.P
The actual capabilities and properties of the created QP will be
-returned to the user through the qp_init_attr parameter.
+returned to the user through the qp_init_attr parameter. An rdma_cm_id
+may only be associated with a single QP.
.SH "SEE ALSO"
rdma_bind_addr(3), rdma_resolve_addr(3), rdma_destroy_qp(3), ibv_create_qp(3),
ibv_modify_qp(3)
struct ibv_qp *qp;
int ret;
+ if (id->qp)
+ return ERR(EINVAL);
+
id_priv = container_of(id, struct cma_id_private, id);
if (!pd)
pd = id_priv->cma_dev->pd;