RDMA/mana_ib: Fix integer overflow during queue creation
Subsystems (2)
PATCH v2 1/1 RDMA/mana_ib: Fix integer overflow during queue creation
From: Konstantin Taranov <[email protected]>
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 <[email protected]>
---
v2: Only check the size of user CQs
drivers/infiniband/hw/mana/cq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mana/cq.c +2 -1
@@ -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 ; }
Signature · 1 line
2.43.0
Quoted 9 lines
Subject: [PATCH rdma-next v2 1/1] RDMA/mana_ib: Fix integer overflow during queue creation
From: Konstantin Taranov <[email protected]>
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 <[email protected]>
Reviewed-by Long Li <[email protected]>
Quoted 25 lines
---
v2: Only check the size of user CQsdrivers/infiniband/hw/mana/cq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mana/cq.c +1
-1@@ -39,7 +39,8 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const structib_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)||
drivers/infiniband/hw/mana/cq.c +1
-1+ attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {ibdev_dbg (ibdev,"CQE %d exceeding limit\n" , attr->cqe);return -EINVAL ; } --2.43.0
Leon Romanovsky
AppliedQuoted 4 lines · Konstantin Taranov
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,
Signature · 1 line
Leon Romanovsky <[email protected]>