Skip to content

Commit f79edef

Browse files
Konstantin Taranovrleon
authored andcommitted
RDMA/mana_ib: boundary check before installing cq callbacks
Add a boundary check inside mana_ib_install_cq_cb to prevent index overflow. Fixes: 2a31c5a ("RDMA/mana_ib: Introduce mana_ib_install_cq_cb helper function") Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com> Link: https://lore.kernel.org/r/1714137160-5222-5-git-send-email-kotaranov@linux.microsoft.com Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 3e41105 commit f79edef

File tree

1 file changed

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

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/mana/cq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ int mana_ib_install_cq_cb(struct mana_ib_dev *mdev, struct mana_ib_cq *cq)
7070
struct gdma_context *gc = mdev_to_gc(mdev);
7171
struct gdma_queue *gdma_cq;
7272

73+
if (cq->queue.id >= gc->max_num_cqs)
74+
return -EINVAL;
7375
/* Create CQ table entry */
7476
WARN_ON(gc->cq_table[cq->queue.id]);
7577
gdma_cq = kzalloc(sizeof(*gdma_cq), GFP_KERNEL);

0 commit comments

Comments
 (0)