Protect the case that a ULP tries to allocate a QP with signature enabled flag while the LLD doesn't support this feature. Signed-off-by: Max Gurtovoy <maxg@xxxxxxxxxxxx> --- drivers/infiniband/core/verbs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 7397a20db000..e1dcbcc58e3e 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1142,10 +1142,12 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, struct ib_qp *qp; int ret; - if (qp_init_attr->rwq_ind_tbl && + if ((qp_init_attr->rwq_ind_tbl && (qp_init_attr->recv_cq || qp_init_attr->srq || qp_init_attr->cap.max_recv_wr || - qp_init_attr->cap.max_recv_sge)) + qp_init_attr->cap.max_recv_sge)) || + ((qp_init_attr->create_flags & IB_QP_CREATE_SIGNATURE_EN) && + !(device->attrs.device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER))) return ERR_PTR(-EINVAL); /* -- 2.16.3