diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-10-11 09:34:19 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-10-22 14:05:36 -0400 |
commit | a9018adfde809d44e71189b984fa61cc89682b5e (patch) | |
tree | 144524aac0d81b2e3c726df9382fb0dc0ba9c978 /include/rdma | |
parent | 777a8b32bc0f9bb25848a025f72a9febc30d9033 (diff) |
RDMA/uverbs: Prevent potential underflow
The issue is in drivers/infiniband/core/uverbs_std_types_cq.c in the
UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE) function. We check that:
if (attr.comp_vector >= attrs->ufile->device->num_comp_vectors) {
But we don't check if "attr.comp_vector" is negative. It could
potentially lead to an array underflow. My concern would be where
cq->vector is used in the create_cq() function from the cxgb4 driver.
And really "attr.comp_vector" is appears as a u32 to user space so that's
the right type to use.
Fixes: 9ee79fce3642 ("IB/core: Add completion queue (cq) object actions")
Link: https://lore.kernel.org/r/20191011133419.GA22905@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/ib_verbs.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 6a47ba85c54c..e7e733add99f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -366,7 +366,7 @@ struct ib_tm_caps { | |||
366 | 366 | ||
367 | struct ib_cq_init_attr { | 367 | struct ib_cq_init_attr { |
368 | unsigned int cqe; | 368 | unsigned int cqe; |
369 | int comp_vector; | 369 | u32 comp_vector; |
370 | u32 flags; | 370 | u32 flags; |
371 | }; | 371 | }; |
372 | 372 | ||