aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-11-25 20:51:18 +0200
committerJason Gunthorpe <jgg@mellanox.com>2018-11-26 16:48:07 -0700
commitef87df2c7a8f04d31cbf06f0b14b8dd5feafe473 (patch)
treee6926935a947d198c37ca33b6a877b6d8d97fed9 /drivers/infiniband/core/uverbs_main.c
parentRDMA/uverbs: Prohibit write() calls with too small buffers (diff)
downloadlinux-dev-ef87df2c7a8f04d31cbf06f0b14b8dd5feafe473.tar.xz
linux-dev-ef87df2c7a8f04d31cbf06f0b14b8dd5feafe473.zip
RDMA/uverbs: Use uverbs_attr_bundle to pass udata for write_ex
The core code needs to compute the udata so we may as well pass it in the uverbs_attr_bundle instead of on the stack. This converts the simple case of write_ex() which already has a core calculation. Also change the write() path to use the attrs for ib_uverbs_init_udata() instead of on the stack. This lets the write to write_ex compatibility path continue to follow the lead of the _ex path. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to '')
-rw-r--r--drivers/infiniband/core/uverbs_main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index bcbee8fc83a9..fc8d3d1c7048 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -697,7 +697,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
hdr.out_words * 4);
} else {
struct ib_udata ucore;
- struct ib_udata uhw;
buf += sizeof(ex_hdr);
@@ -705,13 +704,13 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
u64_to_user_ptr(ex_hdr.response),
hdr.in_words * 8, hdr.out_words * 8);
- ib_uverbs_init_udata_buf_or_null(&uhw,
+ ib_uverbs_init_udata_buf_or_null(&bundle.driver_udata,
buf + ucore.inlen,
u64_to_user_ptr(ex_hdr.response) + ucore.outlen,
ex_hdr.provider_in_words * 8,
ex_hdr.provider_out_words * 8);
- ret = method_elm->handler_ex(&bundle, &ucore, &uhw);
+ ret = method_elm->handler_ex(&bundle, &ucore);
}
srcu_read_unlock(&file->device->disassociate_srcu, srcu_key);