Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53a8b385 authored by Kamal Heib's avatar Kamal Heib Committed by Greg Kroah-Hartman
Browse files

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: cfdda9d7 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
Link: https://lore.kernel.org/r/20201108132007.67537-1-kamalheib1@gmail.com


Signed-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent df79fd25
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -893,6 +893,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);