Skip to content

Commit

Permalink
RDMA/cxgb4: Validate the number of CQEs
Browse files Browse the repository at this point in the history
[ Upstream commit 6d8285e ]

Before create CQ, make sure that the requested number of CQEs is in the
supported range.

Fixes: cfdda9d ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Kamalheib authored and gregkh committed Dec 30, 2020
1 parent d3ff603 commit 4279ff6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/infiniband/hw/cxgb4/cq.c
Expand Up @@ -1007,6 +1007,9 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
if (attr->flags)
return -EINVAL;

if (entries < 1 || entries > ibdev->attrs.max_cqe)
return -EINVAL;

if (vector >= rhp->rdev.lldi.nciq)
return -EINVAL;

Expand Down

0 comments on commit 4279ff6

Please sign in to comment.