diff options
Diffstat (limited to 'drivers/infiniband/core/ucma.c')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index f015f1bf88c9..3a9d0f5b5881 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -1149,6 +1149,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file, | |||
1149 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) | 1149 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1150 | return -EFAULT; | 1150 | return -EFAULT; |
1151 | 1151 | ||
1152 | if (cmd.qp_state > IB_QPS_ERR) | ||
1153 | return -EINVAL; | ||
1154 | |||
1152 | ctx = ucma_get_ctx(file, cmd.id); | 1155 | ctx = ucma_get_ctx(file, cmd.id); |
1153 | if (IS_ERR(ctx)) | 1156 | if (IS_ERR(ctx)) |
1154 | return PTR_ERR(ctx); | 1157 | return PTR_ERR(ctx); |
@@ -1294,6 +1297,9 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf, | |||
1294 | if (IS_ERR(ctx)) | 1297 | if (IS_ERR(ctx)) |
1295 | return PTR_ERR(ctx); | 1298 | return PTR_ERR(ctx); |
1296 | 1299 | ||
1300 | if (unlikely(cmd.optval > KMALLOC_MAX_SIZE)) | ||
1301 | return -EINVAL; | ||
1302 | |||
1297 | optval = memdup_user((void __user *) (unsigned long) cmd.optval, | 1303 | optval = memdup_user((void __user *) (unsigned long) cmd.optval, |
1298 | cmd.optlen); | 1304 | cmd.optlen); |
1299 | if (IS_ERR(optval)) { | 1305 | if (IS_ERR(optval)) { |