* [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation
@ 2025-03-18 15:45 Konstantin Taranov
2025-03-18 17:37 ` Long Li
2025-03-19 8:39 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Taranov @ 2025-03-18 15:45 UTC (permalink / raw)
To: kotaranov, shirazsaleem, longli, jgg, leon; +Cc: linux-rdma, linux-kernel
From: Konstantin Taranov <kotaranov@microsoft.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@microsoft.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation
2025-03-18 15:45 [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation Konstantin Taranov
@ 2025-03-18 17:37 ` Long Li
2025-03-19 8:39 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Long Li @ 2025-03-18 17:37 UTC (permalink / raw)
To: Konstantin Taranov, Konstantin Taranov, Shiraz Saleem, jgg, leon
Cc: linux-rdma, linux-kernel
> Subject: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during
> queue creation
>
> From: Konstantin Taranov <kotaranov@microsoft.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@microsoft.com>
Reviewed-by: Long Li <longli@microsoft.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation
2025-03-18 15:45 [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation Konstantin Taranov
2025-03-18 17:37 ` Long Li
@ 2025-03-19 8:39 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2025-03-19 8:39 UTC (permalink / raw)
To: kotaranov, shirazsaleem, longli, jgg, Konstantin Taranov
Cc: linux-rdma, linux-kernel
On Tue, 18 Mar 2025 08:45:44 -0700, Konstantin Taranov wrote:
> Check queue size during CQ creation for users to prevent
> overflow of u32.
>
>
Applied, thanks!
[1/1] RDMA/mana_ib: Fix integer overflow during queue creation
https://git.kernel.org/rdma/rdma/c/0c55174524227a
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-19 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18 15:45 [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation Konstantin Taranov
2025-03-18 17:37 ` Long Li
2025-03-19 8:39 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®