diff options
| author | Kamal Heib <kamalheib1@gmail.com> | 2020-11-08 15:20:07 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-30 11:25:56 +0100 |
| commit | 0b2f0afa3dc48a4d82c6a2afeb1bfbc0146b6a3c (patch) | |
| tree | 6ad13607047bd7abee16396804516559a83884a0 /drivers/infiniband | |
| parent | c3c96c2b4bcb8c43389b82dd124ebf4c7281e9c5 (diff) | |
| download | linux-0b2f0afa3dc48a4d82c6a2afeb1bfbc0146b6a3c.tar.gz linux-0b2f0afa3dc48a4d82c6a2afeb1bfbc0146b6a3c.tar.bz2 linux-0b2f0afa3dc48a4d82c6a2afeb1bfbc0146b6a3c.zip | |
RDMA/cxgb4: Validate the number of CQEs
[ Upstream commit 6d8285e604e0221b67bd5db736921b7ddce37d00 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/infiniband')
| -rw-r--r-- | drivers/infiniband/hw/cxgb4/cq.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index 1fd8798d91a7..43c611aa068c 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c @@ -1012,6 +1012,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, rhp = to_c4iw_dev(ibdev); + if (entries < 1 || entries > ibdev->attrs.max_cqe) + return ERR_PTR(-EINVAL); + if (vector >= rhp->rdev.lldi.nciq) return ERR_PTR(-EINVAL); |
