mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject()
[ Upstream commit 81f8f7454a
]
Currently, the IB uverbs API calls uobj_get_uobj_read(), which in turn
uses the rdma_lookup_get_uobject() helper to retrieve user objects.
In case of failure, uobj_get_uobj_read() returns NULL, overriding the
error code from rdma_lookup_get_uobject(). The IB uverbs API then
translates this NULL to -EINVAL, masking the actual error and
complicating debugging. For example, applications calling ibv_modify_qp
that fails with EBUSY when retrieving the QP uobject will see the
overridden error code EINVAL instead, masking the actual error.
Furthermore, based on rdma-core commit:
"2a22f1ced5f3 ("Merge pull request #1568 from jakemoroni/master")"
Kernel's IB uverbs return values are either ignored and passed on as is
to application or overridden with other errnos in a few cases.
Thus, to improve error reporting and debuggability, propagate the
original error from rdma_lookup_get_uobject() instead of replacing it
with EINVAL.
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Link: https://patch.msgid.link/64f9d3711b183984e939962c2f83383904f97dfb.1740577869.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
785ac69911
commit
135dde13b9
|
@ -718,8 +718,8 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
||||||
if (!pd) {
|
if (IS_ERR(pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(pd);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,8 +809,8 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
|
||||||
if (cmd.flags & IB_MR_REREG_PD) {
|
if (cmd.flags & IB_MR_REREG_PD) {
|
||||||
new_pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle,
|
new_pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle,
|
||||||
attrs);
|
attrs);
|
||||||
if (!new_pd) {
|
if (IS_ERR(new_pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(new_pd);
|
||||||
goto put_uobjs;
|
goto put_uobjs;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -919,8 +919,8 @@ static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)
|
||||||
return PTR_ERR(uobj);
|
return PTR_ERR(uobj);
|
||||||
|
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
||||||
if (!pd) {
|
if (IS_ERR(pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(pd);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,8 +1127,8 @@ static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
||||||
if (!cq)
|
if (IS_ERR(cq))
|
||||||
return -EINVAL;
|
return PTR_ERR(cq);
|
||||||
|
|
||||||
ret = cq->device->ops.resize_cq(cq, cmd.cqe, &attrs->driver_udata);
|
ret = cq->device->ops.resize_cq(cq, cmd.cqe, &attrs->driver_udata);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -1189,8 +1189,8 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
||||||
if (!cq)
|
if (IS_ERR(cq))
|
||||||
return -EINVAL;
|
return PTR_ERR(cq);
|
||||||
|
|
||||||
/* we copy a struct ib_uverbs_poll_cq_resp to user space */
|
/* we copy a struct ib_uverbs_poll_cq_resp to user space */
|
||||||
header_ptr = attrs->ucore.outbuf;
|
header_ptr = attrs->ucore.outbuf;
|
||||||
|
@ -1238,8 +1238,8 @@ static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
||||||
if (!cq)
|
if (IS_ERR(cq))
|
||||||
return -EINVAL;
|
return PTR_ERR(cq);
|
||||||
|
|
||||||
ib_req_notify_cq(cq, cmd.solicited_only ?
|
ib_req_notify_cq(cq, cmd.solicited_only ?
|
||||||
IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
|
IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
|
||||||
|
@ -1321,8 +1321,8 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
|
||||||
ind_tbl = uobj_get_obj_read(rwq_ind_table,
|
ind_tbl = uobj_get_obj_read(rwq_ind_table,
|
||||||
UVERBS_OBJECT_RWQ_IND_TBL,
|
UVERBS_OBJECT_RWQ_IND_TBL,
|
||||||
cmd->rwq_ind_tbl_handle, attrs);
|
cmd->rwq_ind_tbl_handle, attrs);
|
||||||
if (!ind_tbl) {
|
if (IS_ERR(ind_tbl)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(ind_tbl);
|
||||||
goto err_put;
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,8 +1360,10 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
|
||||||
if (cmd->is_srq) {
|
if (cmd->is_srq) {
|
||||||
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ,
|
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ,
|
||||||
cmd->srq_handle, attrs);
|
cmd->srq_handle, attrs);
|
||||||
if (!srq || srq->srq_type == IB_SRQT_XRC) {
|
if (IS_ERR(srq) ||
|
||||||
ret = -EINVAL;
|
srq->srq_type == IB_SRQT_XRC) {
|
||||||
|
ret = IS_ERR(srq) ? PTR_ERR(srq) :
|
||||||
|
-EINVAL;
|
||||||
goto err_put;
|
goto err_put;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1371,23 +1373,29 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
|
||||||
rcq = uobj_get_obj_read(
|
rcq = uobj_get_obj_read(
|
||||||
cq, UVERBS_OBJECT_CQ,
|
cq, UVERBS_OBJECT_CQ,
|
||||||
cmd->recv_cq_handle, attrs);
|
cmd->recv_cq_handle, attrs);
|
||||||
if (!rcq) {
|
if (IS_ERR(rcq)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(rcq);
|
||||||
goto err_put;
|
goto err_put;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_sq)
|
if (has_sq) {
|
||||||
scq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ,
|
scq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ,
|
||||||
cmd->send_cq_handle, attrs);
|
cmd->send_cq_handle, attrs);
|
||||||
|
if (IS_ERR(scq)) {
|
||||||
|
ret = PTR_ERR(scq);
|
||||||
|
goto err_put;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ind_tbl && cmd->qp_type != IB_QPT_XRC_INI)
|
if (!ind_tbl && cmd->qp_type != IB_QPT_XRC_INI)
|
||||||
rcq = rcq ?: scq;
|
rcq = rcq ?: scq;
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd->pd_handle,
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd->pd_handle,
|
||||||
attrs);
|
attrs);
|
||||||
if (!pd || (!scq && has_sq)) {
|
if (IS_ERR(pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(pd);
|
||||||
goto err_put;
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1482,18 +1490,18 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
|
||||||
err_put:
|
err_put:
|
||||||
if (!IS_ERR(xrcd_uobj))
|
if (!IS_ERR(xrcd_uobj))
|
||||||
uobj_put_read(xrcd_uobj);
|
uobj_put_read(xrcd_uobj);
|
||||||
if (pd)
|
if (!IS_ERR_OR_NULL(pd))
|
||||||
uobj_put_obj_read(pd);
|
uobj_put_obj_read(pd);
|
||||||
if (scq)
|
if (!IS_ERR_OR_NULL(scq))
|
||||||
rdma_lookup_put_uobject(&scq->uobject->uevent.uobject,
|
rdma_lookup_put_uobject(&scq->uobject->uevent.uobject,
|
||||||
UVERBS_LOOKUP_READ);
|
UVERBS_LOOKUP_READ);
|
||||||
if (rcq && rcq != scq)
|
if (!IS_ERR_OR_NULL(rcq) && rcq != scq)
|
||||||
rdma_lookup_put_uobject(&rcq->uobject->uevent.uobject,
|
rdma_lookup_put_uobject(&rcq->uobject->uevent.uobject,
|
||||||
UVERBS_LOOKUP_READ);
|
UVERBS_LOOKUP_READ);
|
||||||
if (srq)
|
if (!IS_ERR_OR_NULL(srq))
|
||||||
rdma_lookup_put_uobject(&srq->uobject->uevent.uobject,
|
rdma_lookup_put_uobject(&srq->uobject->uevent.uobject,
|
||||||
UVERBS_LOOKUP_READ);
|
UVERBS_LOOKUP_READ);
|
||||||
if (ind_tbl)
|
if (!IS_ERR_OR_NULL(ind_tbl))
|
||||||
uobj_put_obj_read(ind_tbl);
|
uobj_put_obj_read(ind_tbl);
|
||||||
|
|
||||||
uobj_alloc_abort(&obj->uevent.uobject, attrs);
|
uobj_alloc_abort(&obj->uevent.uobject, attrs);
|
||||||
|
@ -1655,8 +1663,8 @@ static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp) {
|
if (IS_ERR(qp)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(qp);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1761,8 +1769,8 @@ static int modify_qp(struct uverbs_attr_bundle *attrs,
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd->base.qp_handle,
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd->base.qp_handle,
|
||||||
attrs);
|
attrs);
|
||||||
if (!qp) {
|
if (IS_ERR(qp)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(qp);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2028,8 +2036,8 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp) {
|
if (IS_ERR(qp)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(qp);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2066,9 +2074,9 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)
|
||||||
|
|
||||||
ud->ah = uobj_get_obj_read(ah, UVERBS_OBJECT_AH,
|
ud->ah = uobj_get_obj_read(ah, UVERBS_OBJECT_AH,
|
||||||
user_wr->wr.ud.ah, attrs);
|
user_wr->wr.ud.ah, attrs);
|
||||||
if (!ud->ah) {
|
if (IS_ERR(ud->ah)) {
|
||||||
|
ret = PTR_ERR(ud->ah);
|
||||||
kfree(ud);
|
kfree(ud);
|
||||||
ret = -EINVAL;
|
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
ud->remote_qpn = user_wr->wr.ud.remote_qpn;
|
ud->remote_qpn = user_wr->wr.ud.remote_qpn;
|
||||||
|
@ -2305,8 +2313,8 @@ static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs)
|
||||||
return PTR_ERR(wr);
|
return PTR_ERR(wr);
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp) {
|
if (IS_ERR(qp)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(qp);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2356,8 +2364,8 @@ static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs)
|
||||||
return PTR_ERR(wr);
|
return PTR_ERR(wr);
|
||||||
|
|
||||||
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
||||||
if (!srq) {
|
if (IS_ERR(srq)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(srq);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2413,8 +2421,8 @@ static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
||||||
if (!pd) {
|
if (IS_ERR(pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(pd);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2483,8 +2491,8 @@ static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp)
|
if (IS_ERR(qp))
|
||||||
return -EINVAL;
|
return PTR_ERR(qp);
|
||||||
|
|
||||||
obj = qp->uobject;
|
obj = qp->uobject;
|
||||||
|
|
||||||
|
@ -2533,8 +2541,8 @@ static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp)
|
if (IS_ERR(qp))
|
||||||
return -EINVAL;
|
return PTR_ERR(qp);
|
||||||
|
|
||||||
obj = qp->uobject;
|
obj = qp->uobject;
|
||||||
mutex_lock(&obj->mcast_lock);
|
mutex_lock(&obj->mcast_lock);
|
||||||
|
@ -2668,8 +2676,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,
|
||||||
UVERBS_OBJECT_FLOW_ACTION,
|
UVERBS_OBJECT_FLOW_ACTION,
|
||||||
kern_spec->action.handle,
|
kern_spec->action.handle,
|
||||||
attrs);
|
attrs);
|
||||||
if (!ib_spec->action.act)
|
if (IS_ERR(ib_spec->action.act))
|
||||||
return -EINVAL;
|
return PTR_ERR(ib_spec->action.act);
|
||||||
ib_spec->action.size =
|
ib_spec->action.size =
|
||||||
sizeof(struct ib_flow_spec_action_handle);
|
sizeof(struct ib_flow_spec_action_handle);
|
||||||
flow_resources_add(uflow_res,
|
flow_resources_add(uflow_res,
|
||||||
|
@ -2686,8 +2694,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,
|
||||||
UVERBS_OBJECT_COUNTERS,
|
UVERBS_OBJECT_COUNTERS,
|
||||||
kern_spec->flow_count.handle,
|
kern_spec->flow_count.handle,
|
||||||
attrs);
|
attrs);
|
||||||
if (!ib_spec->flow_count.counters)
|
if (IS_ERR(ib_spec->flow_count.counters))
|
||||||
return -EINVAL;
|
return PTR_ERR(ib_spec->flow_count.counters);
|
||||||
ib_spec->flow_count.size =
|
ib_spec->flow_count.size =
|
||||||
sizeof(struct ib_flow_spec_action_count);
|
sizeof(struct ib_flow_spec_action_count);
|
||||||
flow_resources_add(uflow_res,
|
flow_resources_add(uflow_res,
|
||||||
|
@ -2905,14 +2913,14 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)
|
||||||
return PTR_ERR(obj);
|
return PTR_ERR(obj);
|
||||||
|
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle, attrs);
|
||||||
if (!pd) {
|
if (IS_ERR(pd)) {
|
||||||
err = -EINVAL;
|
err = PTR_ERR(pd);
|
||||||
goto err_uobj;
|
goto err_uobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
||||||
if (!cq) {
|
if (IS_ERR(cq)) {
|
||||||
err = -EINVAL;
|
err = PTR_ERR(cq);
|
||||||
goto err_put_pd;
|
goto err_put_pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3013,8 +3021,8 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
wq = uobj_get_obj_read(wq, UVERBS_OBJECT_WQ, cmd.wq_handle, attrs);
|
wq = uobj_get_obj_read(wq, UVERBS_OBJECT_WQ, cmd.wq_handle, attrs);
|
||||||
if (!wq)
|
if (IS_ERR(wq))
|
||||||
return -EINVAL;
|
return PTR_ERR(wq);
|
||||||
|
|
||||||
if (cmd.attr_mask & IB_WQ_FLAGS) {
|
if (cmd.attr_mask & IB_WQ_FLAGS) {
|
||||||
wq_attr.flags = cmd.flags;
|
wq_attr.flags = cmd.flags;
|
||||||
|
@ -3097,8 +3105,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs)
|
||||||
num_read_wqs++) {
|
num_read_wqs++) {
|
||||||
wq = uobj_get_obj_read(wq, UVERBS_OBJECT_WQ,
|
wq = uobj_get_obj_read(wq, UVERBS_OBJECT_WQ,
|
||||||
wqs_handles[num_read_wqs], attrs);
|
wqs_handles[num_read_wqs], attrs);
|
||||||
if (!wq) {
|
if (IS_ERR(wq)) {
|
||||||
err = -EINVAL;
|
err = PTR_ERR(wq);
|
||||||
goto put_wqs;
|
goto put_wqs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3253,8 +3261,8 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
|
||||||
if (!qp) {
|
if (IS_ERR(qp)) {
|
||||||
err = -EINVAL;
|
err = PTR_ERR(qp);
|
||||||
goto err_uobj;
|
goto err_uobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3400,15 +3408,15 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
|
||||||
if (ib_srq_has_cq(cmd->srq_type)) {
|
if (ib_srq_has_cq(cmd->srq_type)) {
|
||||||
attr.ext.cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ,
|
attr.ext.cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ,
|
||||||
cmd->cq_handle, attrs);
|
cmd->cq_handle, attrs);
|
||||||
if (!attr.ext.cq) {
|
if (IS_ERR(attr.ext.cq)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(attr.ext.cq);
|
||||||
goto err_put_xrcd;
|
goto err_put_xrcd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd->pd_handle, attrs);
|
pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd->pd_handle, attrs);
|
||||||
if (!pd) {
|
if (IS_ERR(pd)) {
|
||||||
ret = -EINVAL;
|
ret = PTR_ERR(pd);
|
||||||
goto err_put_cq;
|
goto err_put_cq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3515,8 +3523,8 @@ static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
||||||
if (!srq)
|
if (IS_ERR(srq))
|
||||||
return -EINVAL;
|
return PTR_ERR(srq);
|
||||||
|
|
||||||
attr.max_wr = cmd.max_wr;
|
attr.max_wr = cmd.max_wr;
|
||||||
attr.srq_limit = cmd.srq_limit;
|
attr.srq_limit = cmd.srq_limit;
|
||||||
|
@ -3543,8 +3551,8 @@ static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
srq = uobj_get_obj_read(srq, UVERBS_OBJECT_SRQ, cmd.srq_handle, attrs);
|
||||||
if (!srq)
|
if (IS_ERR(srq))
|
||||||
return -EINVAL;
|
return PTR_ERR(srq);
|
||||||
|
|
||||||
ret = ib_query_srq(srq, &attr);
|
ret = ib_query_srq(srq, &attr);
|
||||||
|
|
||||||
|
@ -3669,8 +3677,8 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
|
||||||
if (!cq)
|
if (IS_ERR(cq))
|
||||||
return -EINVAL;
|
return PTR_ERR(cq);
|
||||||
|
|
||||||
ret = rdma_set_cq_moderation(cq, cmd.attr.cq_count, cmd.attr.cq_period);
|
ret = rdma_set_cq_moderation(cq, cmd.attr.cq_count, cmd.attr.cq_period);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
static inline void *_uobj_get_obj_read(struct ib_uobject *uobj)
|
static inline void *_uobj_get_obj_read(struct ib_uobject *uobj)
|
||||||
{
|
{
|
||||||
if (IS_ERR(uobj))
|
if (IS_ERR(uobj))
|
||||||
return NULL;
|
return ERR_CAST(uobj);
|
||||||
return uobj->object;
|
return uobj->object;
|
||||||
}
|
}
|
||||||
#define uobj_get_obj_read(_object, _type, _id, _attrs) \
|
#define uobj_get_obj_read(_object, _type, _id, _attrs) \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user