X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=drivers%2Finfiniband%2Fcore%2Fucma.c;h=79d03330cc57c919d38176f76e26d0362efa3350;hp=91e82b7dadfa9d4feb5613c2c6b77c7d584eb56b;hb=225c79af589fd48a19c42e9f50cfa05a24815bda;hpb=7cd419255d03561d98c94fad1a027a539c4a7484 diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 91e82b7dadfa..79d03330cc57 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1000,6 +1000,9 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf, if (IS_ERR(ctx)) return PTR_ERR(ctx); + if (unlikely(cmd.optval > KMALLOC_MAX_SIZE)) + return -EINVAL; + optval = kmalloc(cmd.optlen, GFP_KERNEL); if (!optval) { ret = -ENOMEM;