summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/ucma.c
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2020-10-10 13:30:49 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2020-10-10 13:30:49 +0200
commit566575659eec6b0a72de46dd1c3ae8fc221a90a5 (patch)
treefed807b5725b3592752bb19005c9eea9dbcd387d /drivers/infiniband/core/ucma.c
parentf1442a59da02a0b5ef648925f2f274a3e64999cc (diff)
parent18f617d6f398c264e3172532a5d3c656f17cecfa (diff)
Merge tag 'v4.4.238' into toradex_vf_4.4-next
This is the 4.4.238 stable release Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'drivers/infiniband/core/ucma.c')
-rw-r--r--drivers/infiniband/core/ucma.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index 3e4d3d5560bf..6315f77b4a58 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1295,13 +1295,13 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf,
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
return -EFAULT;
+ if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE))
+ return -EINVAL;
+
ctx = ucma_get_ctx(file, cmd.id);
if (IS_ERR(ctx))
return PTR_ERR(ctx);
- if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE))
- return -EINVAL;
-
optval = memdup_user((void __user *) (unsigned long) cmd.optval,
cmd.optlen);
if (IS_ERR(optval)) {