]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RDMA/irdma: Validate number of CQ entries on create CQ
authorSindhu Devale <sindhu.devale@intel.com>
Thu, 16 Sep 2021 19:12:20 +0000 (14:12 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 20 Sep 2021 17:13:23 +0000 (14:13 -0300)
Add lower bound check for CQ entries at creation time.

Fixes: ec118db05224 ("RDMA/irdma: Implement device supported verb APIs")
Link: https://lore.kernel.org/r/20210916191222.824-3-shiraz.saleem@intel.com
Signed-off-by: Sindhu Devale <sindhu.devale@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/irdma/verbs.c

index 829ddfa7e144fb5adabc989d1e44f8cd178cbc7e..23c47482c749fd9d4c1152dc550bb36a92e9cdd5 100644 (file)
@@ -2034,7 +2034,7 @@ static int irdma_create_cq(struct ib_cq *ibcq,
                /* Kmode allocations */
                int rsize;
 
-               if (entries > rf->max_cqe) {
+               if (entries < 1 || entries > rf->max_cqe) {
                        err_code = -EINVAL;
                        goto cq_free_rsrc;
                }