aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-11-25 20:58:45 +0200
committerDoug Ledford <dledford@redhat.com>2018-12-03 12:01:58 -0500
commit974d6b4b2bc33c53334e086a40715b384f48f2e2 (patch)
tree86a6308f6ce39cc4127f0e4f03dd8348e4b7effd
parentRDMA/uverbs: Do not check the input length on create_cq/qp paths (diff)
downloadlinux-dev-974d6b4b2bc33c53334e086a40715b384f48f2e2.tar.xz
linux-dev-974d6b4b2bc33c53334e086a40715b384f48f2e2.zip
RDMA/uverbs: Use only attrs for the write() handler signature
All of the old arguments can be derived from the uverbs_attr_bundle structure, so get rid of the redundant arguments. Most of the prior work has been removing users of the arguments to allow this to be a simple patch. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/rdma_core.h5
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c150
-rw-r--r--drivers/infiniband/core/uverbs_main.c4
-rw-r--r--drivers/infiniband/core/uverbs_uapi.c23
-rw-r--r--include/rdma/uverbs_ioctl.h8
5 files changed, 56 insertions, 134 deletions
diff --git a/drivers/infiniband/core/rdma_core.h b/drivers/infiniband/core/rdma_core.h
index b1bf1579fc26..bac484d6753a 100644
--- a/drivers/infiniband/core/rdma_core.h
+++ b/drivers/infiniband/core/rdma_core.h
@@ -137,10 +137,7 @@ struct uverbs_api_ioctl_method {
};
struct uverbs_api_write_method {
- int (*handler)(struct uverbs_attr_bundle *attrs, const char __user *buf,
- int in_len, int out_len);
- int (*handler_ex)(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore);
+ int (*handler)(struct uverbs_attr_bundle *attrs);
u8 disabled:1;
u8 is_ex:1;
u8 has_udata:1;
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 11e2175e0362..4dab9f7e1f94 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -186,9 +186,7 @@ _ib_uverbs_lookup_comp_file(s32 fd, const struct uverbs_attr_bundle *attrs)
#define ib_uverbs_lookup_comp_file(_fd, _ufile) \
_ib_uverbs_lookup_comp_file((_fd)*typecheck(s32, _fd), _ufile)
-static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_file *file = attrs->ufile;
struct ib_uverbs_get_context cmd;
@@ -337,9 +335,7 @@ static void copy_query_dev_fields(struct ib_ucontext *ucontext,
resp->phys_port_cnt = ib_dev->phys_port_cnt;
}
-static int ib_uverbs_query_device(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_query_device(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_query_device cmd;
struct ib_uverbs_query_device_resp resp;
@@ -381,8 +377,7 @@ static u32 make_port_cap_flags(const struct ib_port_attr *attr)
return res;
}
-static int ib_uverbs_query_port(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_query_port(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_query_port cmd;
struct ib_uverbs_query_port_resp resp;
@@ -440,8 +435,7 @@ static int ib_uverbs_query_port(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_alloc_pd cmd;
struct ib_uverbs_alloc_pd_resp resp;
@@ -489,8 +483,7 @@ err:
return ret;
}
-static int ib_uverbs_dealloc_pd(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_dealloc_pd(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_dealloc_pd cmd;
int ret;
@@ -587,8 +580,7 @@ static void xrcd_table_delete(struct ib_uverbs_device *dev,
}
}
-static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_device *ibudev = attrs->ufile->device;
struct ib_uverbs_open_xrcd cmd;
@@ -700,8 +692,7 @@ err_tree_mutex_unlock:
return ret;
}
-static int ib_uverbs_close_xrcd(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_close_xrcd(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_close_xrcd cmd;
int ret;
@@ -738,8 +729,7 @@ int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject,
return ret;
}
-static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_reg_mr cmd;
struct ib_uverbs_reg_mr_resp resp;
@@ -820,8 +810,7 @@ err_free:
return ret;
}
-static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_rereg_mr cmd;
struct ib_uverbs_rereg_mr_resp resp;
@@ -899,8 +888,7 @@ put_uobjs:
return ret;
}
-static int ib_uverbs_dereg_mr(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_dereg_mr(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_dereg_mr cmd;
int ret;
@@ -912,8 +900,7 @@ static int ib_uverbs_dereg_mr(struct uverbs_attr_bundle *attrs,
return uobj_perform_destroy(UVERBS_OBJECT_MR, cmd.mr_handle, attrs);
}
-static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_alloc_mw cmd;
struct ib_uverbs_alloc_mw_resp resp;
@@ -970,8 +957,7 @@ err_free:
return ret;
}
-static int ib_uverbs_dealloc_mw(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_dealloc_mw(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_dealloc_mw cmd;
int ret;
@@ -983,9 +969,7 @@ static int ib_uverbs_dealloc_mw(struct uverbs_attr_bundle *attrs,
return uobj_perform_destroy(UVERBS_OBJECT_MW, cmd.mw_handle, attrs);
}
-static int ib_uverbs_create_comp_channel(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_create_comp_channel(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_comp_channel cmd;
struct ib_uverbs_create_comp_channel_resp resp;
@@ -1099,8 +1083,7 @@ err:
return ERR_PTR(ret);
}
-static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_cq cmd;
struct ib_uverbs_ex_create_cq cmd_ex;
@@ -1121,8 +1104,7 @@ static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs,
return PTR_ERR_OR_ZERO(obj);
}
-static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_create_cq cmd;
struct ib_ucq_object *obj;
@@ -1142,8 +1124,7 @@ static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs,
return PTR_ERR_OR_ZERO(obj);
}
-static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_resize_cq cmd;
struct ib_uverbs_resize_cq_resp resp = {};
@@ -1201,8 +1182,7 @@ static int copy_wc_to_user(struct ib_device *ib_dev, void __user *dest,
return 0;
}
-static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_poll_cq cmd;
struct ib_uverbs_poll_cq_resp resp;
@@ -1252,9 +1232,7 @@ out_put:
return ret;
}
-static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_req_notify_cq cmd;
struct ib_cq *cq;
@@ -1276,8 +1254,7 @@ static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs,
return 0;
}
-static int ib_uverbs_destroy_cq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_destroy_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_destroy_cq cmd;
struct ib_uverbs_destroy_cq_resp resp;
@@ -1549,8 +1526,7 @@ err_put:
return ret;
}
-static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_qp cmd;
struct ib_uverbs_ex_create_qp cmd_ex;
@@ -1578,8 +1554,7 @@ static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs,
return create_qp(attrs, &cmd_ex);
}
-static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_create_qp cmd;
int ret;
@@ -1597,8 +1572,7 @@ static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs,
return create_qp(attrs, &cmd);
}
-static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_open_qp cmd;
struct ib_uverbs_create_qp_resp resp;
@@ -1695,8 +1669,7 @@ static void copy_ah_attr_to_uverbs(struct ib_uverbs_qp_dest *uverb_attr,
uverb_attr->port_num = rdma_ah_get_port_num(rdma_attr);
}
-static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_query_qp cmd;
struct ib_uverbs_query_qp_resp resp;
@@ -1968,8 +1941,7 @@ out:
return ret;
}
-static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_modify_qp cmd;
int ret;
@@ -1985,8 +1957,7 @@ static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs,
return modify_qp(attrs, &cmd);
}
-static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_modify_qp cmd;
struct ib_uverbs_ex_modify_qp_resp resp = {
@@ -2015,8 +1986,7 @@ static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_destroy_qp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_destroy_qp(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_destroy_qp cmd;
struct ib_uverbs_destroy_qp_resp resp;
@@ -2051,8 +2021,7 @@ static void *alloc_wr(size_t wr_size, __u32 num_sge)
num_sge * sizeof (struct ib_sge), GFP_KERNEL);
}
-static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_post_send cmd;
struct ib_uverbs_post_send_resp resp;
@@ -2341,8 +2310,7 @@ err:
return ERR_PTR(ret);
}
-static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_post_recv cmd;
struct ib_uverbs_post_recv_resp resp;
@@ -2392,9 +2360,7 @@ out:
return ret;
}
-static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_post_srq_recv cmd;
struct ib_uverbs_post_srq_recv_resp resp;
@@ -2445,8 +2411,7 @@ out:
return ret;
}
-static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_ah cmd;
struct ib_uverbs_create_ah_resp resp;
@@ -2524,8 +2489,7 @@ err:
return ret;
}
-static int ib_uverbs_destroy_ah(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_destroy_ah(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_destroy_ah cmd;
int ret;
@@ -2537,9 +2501,7 @@ static int ib_uverbs_destroy_ah(struct uverbs_attr_bundle *attrs,
return uobj_perform_destroy(UVERBS_OBJECT_AH, cmd.ah_handle, attrs);
}
-static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_attach_mcast cmd;
struct ib_qp *qp;
@@ -2587,9 +2549,7 @@ out_put:
return ret;
}
-static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_detach_mcast cmd;
struct ib_uqp_object *obj;
@@ -2950,8 +2910,7 @@ static int kern_spec_to_ib_spec(struct uverbs_attr_bundle *attrs,
return kern_spec_to_ib_spec_filter(kern_spec, ib_spec);
}
-static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_create_wq cmd;
struct ib_uverbs_ex_create_wq_resp resp = {};
@@ -3042,8 +3001,7 @@ err_uobj:
return err;
}
-static int ib_uverbs_ex_destroy_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_destroy_wq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_destroy_wq cmd;
struct ib_uverbs_ex_destroy_wq_resp resp = {};
@@ -3071,8 +3029,7 @@ static int ib_uverbs_ex_destroy_wq(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_modify_wq cmd;
struct ib_wq *wq;
@@ -3105,8 +3062,7 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs,
return ret;
}
-static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_create_rwq_ind_table cmd;
struct ib_uverbs_ex_create_rwq_ind_table_resp resp = {};
@@ -3220,8 +3176,7 @@ err_free:
return err;
}
-static int ib_uverbs_ex_destroy_rwq_ind_table(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_destroy_rwq_ind_table(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_destroy_rwq_ind_table cmd;
int ret;
@@ -3237,8 +3192,7 @@ static int ib_uverbs_ex_destroy_rwq_ind_table(struct uverbs_attr_bundle *attrs,
cmd.ind_tbl_handle, attrs);
}
-static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_flow cmd;
struct ib_uverbs_create_flow_resp resp;
@@ -3403,8 +3357,7 @@ err_free_attr:
return err;
}
-static int ib_uverbs_ex_destroy_flow(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_destroy_flow(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_destroy_flow cmd;
int ret;
@@ -3553,8 +3506,7 @@ err:
return ret;
}
-static int ib_uverbs_create_srq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_create_srq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_srq cmd;
struct ib_uverbs_create_xsrq xcmd;
@@ -3576,9 +3528,7 @@ static int ib_uverbs_create_srq(struct uverbs_attr_bundle *attrs,
return __uverbs_create_xsrq(attrs, &xcmd, &attrs->driver_udata);
}
-static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_create_xsrq cmd;
int ret;
@@ -3590,8 +3540,7 @@ static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
return __uverbs_create_xsrq(attrs, &cmd, &attrs->driver_udata);
}
-static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_modify_srq cmd;
struct ib_srq *srq;
@@ -3617,8 +3566,7 @@ static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs,
return ret;
}
-static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
+static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_query_srq cmd;
struct ib_uverbs_query_srq_resp resp;
@@ -3650,9 +3598,7 @@ static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_destroy_srq(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len)
+static int ib_uverbs_destroy_srq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_destroy_srq cmd;
struct ib_uverbs_destroy_srq_resp resp;
@@ -3677,8 +3623,7 @@ static int ib_uverbs_destroy_srq(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_query_device_resp resp = {};
struct ib_uverbs_ex_query_device cmd;
@@ -3743,8 +3688,7 @@ static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs,
return uverbs_response(attrs, &resp, sizeof(resp));
}
-static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
{
struct ib_uverbs_ex_modify_cq cmd;
struct ib_cq *cq;
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 762a6acbff80..96a5f89bbb75 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -739,8 +739,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
ib_uverbs_init_udata_buf_or_null(
&bundle.ucore, buf, u64_to_user_ptr(response),
in_len, out_len);
-
- ret = method_elm->handler(&bundle, buf, in_len, out_len);
} else {
buf += sizeof(ex_hdr);
@@ -754,9 +752,9 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
ex_hdr.provider_in_words * 8,
ex_hdr.provider_out_words * 8);
- ret = method_elm->handler_ex(&bundle, &bundle.ucore);
}
+ ret = method_elm->handler(&bundle);
out_unlock:
srcu_read_unlock(&file->device->disassociate_srcu, srcu_key);
return (ret) ? : count;
diff --git a/drivers/infiniband/core/uverbs_uapi.c b/drivers/infiniband/core/uverbs_uapi.c
index b3d5f36b0462..19ae4b19b2ef 100644
--- a/drivers/infiniband/core/uverbs_uapi.c
+++ b/drivers/infiniband/core/uverbs_uapi.c
@@ -8,14 +8,7 @@
#include "rdma_core.h"
#include "uverbs.h"
-static int ib_uverbs_notsupp(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len, int out_len)
-{
- return -EOPNOTSUPP;
-}
-
-static int ib_uverbs_ex_notsupp(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore)
+static int ib_uverbs_notsupp(struct uverbs_attr_bundle *attrs)
{
return -EOPNOTSUPP;
}
@@ -79,22 +72,17 @@ static int uapi_create_write(struct uverbs_api *uapi,
if (IS_ERR(method_elm))
return PTR_ERR(method_elm);
- if (WARN_ON(exists && (def->write.is_ex != method_elm->is_ex ||
- method_elm->handler_ex || method_elm->handler)))
+ if (WARN_ON(exists && (def->write.is_ex != method_elm->is_ex)))
return -EINVAL;
method_elm->is_ex = def->write.is_ex;
- if (def->write.is_ex) {
- method_elm->handler_ex = def->func_write_ex;
-
+ method_elm->handler = def->func_write;
+ if (def->write.is_ex)
method_elm->disabled = !(ibdev->uverbs_ex_cmd_mask &
BIT_ULL(def->write.command_num));
- } else {
- method_elm->handler = def->func_write;
-
+ else
method_elm->disabled = !(ibdev->uverbs_cmd_mask &
BIT_ULL(def->write.command_num));
- }
if (!def->write.is_ex && def->func_write) {
method_elm->has_udata = def->write.has_udata;
@@ -449,7 +437,6 @@ static int uapi_finalize(struct uverbs_api *uapi)
}
uapi->notsupp_method.handler = ib_uverbs_notsupp;
- uapi->notsupp_method.handler_ex = ib_uverbs_ex_notsupp;
uapi->num_write = max_write + 1;
uapi->num_write_ex = max_write_ex + 1;
data = kmalloc_array(uapi->num_write + uapi->num_write_ex,
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 9486a525afc1..7f4ace93e502 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -373,11 +373,7 @@ struct uapi_definition {
union {
bool (*func_is_supported)(struct ib_device *device);
- int (*func_write)(struct uverbs_attr_bundle *attrs,
- const char __user *buf, int in_len,
- int out_len);
- int (*func_write_ex)(struct uverbs_attr_bundle *attrs,
- struct ib_udata *ucore);
+ int (*func_write)(struct uverbs_attr_bundle *attrs);
const struct uapi_definition *chain;
const struct uverbs_object_def *chain_obj_tree;
size_t needs_fn_offset;
@@ -409,7 +405,7 @@ struct uapi_definition {
.kind = UAPI_DEF_WRITE, \
.scope = UAPI_SCOPE_OBJECT, \
.write = { .is_ex = 1, .command_num = _command_num }, \
- .func_write_ex = _func, \
+ .func_write = _func, \
_cmd_desc, \
}, \
##__VA_ARGS__