|
@@ -367,20 +367,12 @@ ssize_t ib_uverbs_dealloc_pd(struct ib_uverbs_file *file,
|
|
|
int in_len, int out_len)
|
|
|
{
|
|
|
struct ib_uverbs_dealloc_pd cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
- int ret;
|
|
|
|
|
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_PD, cmd.pd_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
-
|
|
|
- return ret ?: in_len;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_PD, cmd.pd_handle, file,
|
|
|
+ in_len);
|
|
|
}
|
|
|
|
|
|
struct xrcd_table_entry {
|
|
@@ -597,19 +589,12 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *file,
|
|
|
int out_len)
|
|
|
{
|
|
|
struct ib_uverbs_close_xrcd cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
- int ret = 0;
|
|
|
|
|
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_XRCD, cmd.xrcd_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
- return ret ?: in_len;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_XRCD, cmd.xrcd_handle, file,
|
|
|
+ in_len);
|
|
|
}
|
|
|
|
|
|
int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject,
|
|
@@ -829,20 +814,12 @@ ssize_t ib_uverbs_dereg_mr(struct ib_uverbs_file *file,
|
|
|
int out_len)
|
|
|
{
|
|
|
struct ib_uverbs_dereg_mr cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
- int ret = -EINVAL;
|
|
|
|
|
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_MR, cmd.mr_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
-
|
|
|
- return ret ?: in_len;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_MR, cmd.mr_handle, file,
|
|
|
+ in_len);
|
|
|
}
|
|
|
|
|
|
ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
|
|
@@ -921,19 +898,12 @@ ssize_t ib_uverbs_dealloc_mw(struct ib_uverbs_file *file,
|
|
|
int out_len)
|
|
|
{
|
|
|
struct ib_uverbs_dealloc_mw cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
- int ret = -EINVAL;
|
|
|
|
|
|
if (copy_from_user(&cmd, buf, sizeof(cmd)))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_MW, cmd.mw_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
- return ret ?: in_len;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_MW, cmd.mw_handle, file,
|
|
|
+ in_len);
|
|
|
}
|
|
|
|
|
|
ssize_t ib_uverbs_create_comp_channel(struct ib_uverbs_file *file,
|
|
@@ -2641,19 +2611,12 @@ ssize_t ib_uverbs_destroy_ah(struct ib_uverbs_file *file,
|
|
|
const char __user *buf, int in_len, int out_len)
|
|
|
{
|
|
|
struct ib_uverbs_destroy_ah cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
- int ret;
|
|
|
|
|
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_AH, cmd.ah_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
- return ret ?: in_len;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_AH, cmd.ah_handle, file,
|
|
|
+ in_len);
|
|
|
}
|
|
|
|
|
|
ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
|
|
@@ -3445,7 +3408,6 @@ int ib_uverbs_ex_destroy_rwq_ind_table(struct ib_uverbs_file *file,
|
|
|
struct ib_udata *uhw)
|
|
|
{
|
|
|
struct ib_uverbs_ex_destroy_rwq_ind_table cmd = {};
|
|
|
- struct ib_uobject *uobj;
|
|
|
int ret;
|
|
|
size_t required_cmd_sz;
|
|
|
|
|
@@ -3466,12 +3428,8 @@ int ib_uverbs_ex_destroy_rwq_ind_table(struct ib_uverbs_file *file,
|
|
|
if (cmd.comp_mask)
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_RWQ_IND_TBL, cmd.ind_tbl_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- return uobj_remove_commit(uobj);
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_RWQ_IND_TBL,
|
|
|
+ cmd.ind_tbl_handle, file, 0);
|
|
|
}
|
|
|
|
|
|
int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
|
|
@@ -3658,7 +3616,6 @@ int ib_uverbs_ex_destroy_flow(struct ib_uverbs_file *file,
|
|
|
struct ib_udata *uhw)
|
|
|
{
|
|
|
struct ib_uverbs_destroy_flow cmd;
|
|
|
- struct ib_uobject *uobj;
|
|
|
int ret;
|
|
|
|
|
|
if (ucore->inlen < sizeof(cmd))
|
|
@@ -3671,13 +3628,8 @@ int ib_uverbs_ex_destroy_flow(struct ib_uverbs_file *file,
|
|
|
if (cmd.comp_mask)
|
|
|
return -EINVAL;
|
|
|
|
|
|
- uobj = uobj_get_write(UVERBS_OBJECT_FLOW, cmd.flow_handle,
|
|
|
- file->ucontext);
|
|
|
- if (IS_ERR(uobj))
|
|
|
- return PTR_ERR(uobj);
|
|
|
-
|
|
|
- ret = uobj_remove_commit(uobj);
|
|
|
- return ret;
|
|
|
+ return uobj_perform_destroy(UVERBS_OBJECT_FLOW, cmd.flow_handle, file,
|
|
|
+ 0);
|
|
|
}
|
|
|
|
|
|
static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
|