RDMA/mana_ib: check cqe length for kernel CQs
Subsystems (2)
PATCH 1/1 RDMA/mana_ib: check cqe length for kernel CQs
From: Konstantin Taranov <[email protected]>
Check queue size during kernel CQ creation to prevent overflow of u32.
Fixes bec127e45d9f ("RDMA/mana_ib: create kernel-level CQs")
Signed-off-by Konstantin Taranov <[email protected]>
--- drivers/infiniband/hw/mana/cq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/infiniband/hw/mana/cq.c +4 -0
@@ -56,6 +56,10 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, doorbell = mana_ucontext->doorbell; }else { is_rnic_cq = true; +if (attr->cqe >U32_MAX /COMP_ENTRY_SIZE /2 +1 ) { +ibdev_dbg (ibdev,"CQE %d exceeding limit\n" , attr->cqe); +return -EINVAL ; + } buf_size =MANA_PAGE_ALIGN (roundup_pow_of_two (attr->cqe *COMP_ENTRY_SIZE )); cq->cqe = buf_size /COMP_ENTRY_SIZE ; err =mana_ib_create_kernel_queue (mdev, buf_size,GDMA_CQ , &cq->queue);
Signature · 1 line
2.43.0
Quoted 8 lines
Subject: [PATCH rdma-next] RDMA/mana_ib: check cqe length for kernel CQs
From: Konstantin Taranov <[email protected]>
Check queue size during kernel CQ creation 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
--- drivers/infiniband/hw/mana/cq.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/drivers/infiniband/hw/mana/cq.cindex1becc8779..7600412b0100644drivers/infiniband/hw/mana/cq.c +4
-0@@ -56,6 +56,10 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const structib_cq_init_attr *attr, doorbell = mana_ucontext->doorbell; }else { is_rnic_cq = true; +if (attr->cqe >U32_MAX /COMP_ENTRY_SIZE /2 +1 ) { +ibdev_dbg (ibdev,"CQE %d exceeding limit\n" , attr- >cqe); +return -EINVAL ; + } buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr-Quoted 1 line
cqe *
COMP_ENTRY_SIZE));drivers/infiniband/hw/mana/cq.c +0
-0cq->cqe = buf_size /COMP_ENTRY_SIZE ; err = mana_ib_create_kernel_queue(mdev, buf_size,
GDMA_CQ,&cq->queue);
--
2.43.0
Quoted 10 lines · Konstantin Taranov
From: Konstantin Taranov <[email protected]>
Check queue size during kernel CQ creation 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]>--- drivers/infiniband/hw/mana/cq.c | 4 ++++ 1 file changed, 4 insertions(+)
Applied to for-rc, thanks
Jason