[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<LV8PR21MB4236C2474B900EB82EAA49CDCEDE2@LV8PR21MB4236.namprd21.prod.outlook.com>
Date: Tue, 18 Mar 2025 17:37:39 +0000
From: Long Li <longli@...rosoft.com>
To: Konstantin Taranov <kotaranov@...ux.microsoft.com>, Konstantin Taranov
<kotaranov@...rosoft.com>, Shiraz Saleem <shirazsaleem@...rosoft.com>,
"jgg@...pe.ca" <jgg@...pe.ca>, "leon@...nel.org" <leon@...nel.org>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow
during queue creation
> Subject: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during
> queue creation
>
> From: Konstantin Taranov <kotaranov@...rosoft.com>
>
> Check queue size during CQ creation for users to prevent overflow of u32.
>
> Fixes: bec127e45d9f ("RDMA/mana_ib: create kernel-level CQs")
> Signed-off-by: Konstantin Taranov <kotaranov@...rosoft.com>
Reviewed-by: Long Li <longli@...rosoft.com>
> ---
> v2: Only check the size of user CQs
>
> drivers/infiniband/hw/mana/cq.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/mana/cq.c b/drivers/infiniband/hw/mana/cq.c
> index 5c325ef..0fc4e26 100644
> --- a/drivers/infiniband/hw/mana/cq.c
> +++ b/drivers/infiniband/hw/mana/cq.c
> @@ -39,7 +39,8 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct
> ib_cq_init_attr *attr,
>
> is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
>
> - if (!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr)
> {
> + if ((!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr)
> ||
> + attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {
> ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr->cqe);
> return -EINVAL;
> }
> --
> 2.43.0
Powered by blists - more mailing lists