aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4
diff options
context:
space:
mode:
authorKamal Heib <kamalheib1@gmail.com>2020-11-08 15:20:07 +0200
committerJason Gunthorpe <jgg@nvidia.com>2020-11-23 16:19:46 -0400
commit6d8285e604e0221b67bd5db736921b7ddce37d00 (patch)
tree787917ee6c253a35a6bd8156d43c31364b886be0 /drivers/infiniband/hw/cxgb4
parentRDMA/siw,rxe: Make emulated devices virtual in the device tree (diff)
downloadlinux-dev-6d8285e604e0221b67bd5db736921b7ddce37d00.tar.xz
linux-dev-6d8285e604e0221b67bd5db736921b7ddce37d00.zip
RDMA/cxgb4: Validate the number of CQEs
Before create CQ, make sure that the requested number of CQEs is in the supported range. Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC") Link: https://lore.kernel.org/r/20201108132007.67537-1-kamalheib1@gmail.com Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4')
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 2cb65be24770..44c2416588d4 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -1008,6 +1008,9 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
if (attr->flags)
return -EOPNOTSUPP;
+ if (entries < 1 || entries > ibdev->attrs.max_cqe)
+ return -EINVAL;
+
if (vector >= rhp->rdev.lldi.nciq)
return -EINVAL;