Skip to content

Commit 0c55174

Browse files
Konstantin Taranovrleon
authored andcommitted
RDMA/mana_ib: Fix integer overflow during queue creation
Check queue size during CQ creation for users to prevent overflow of u32. Fixes: bec127e ("RDMA/mana_ib: create kernel-level CQs") Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com> Link: https://patch.msgid.link/1742312744-14370-1-git-send-email-kotaranov@linux.microsoft.com Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 7919514 commit 0c55174

File tree

1 file changed

+2
-1
lines changed
  • drivers/infiniband/hw/mana

1 file changed

+2
-1
lines changed

drivers/infiniband/hw/mana/cq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
3939

4040
is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
4141

42-
if (!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr) {
42+
if ((!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr) ||
43+
attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {
4344
ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr->cqe);
4445
return -EINVAL;
4546
}

0 commit comments

Comments
 (0)