Skip to content

Commit

Permalink
net: mana: Fix error handling in mana_create_rxq()
Browse files Browse the repository at this point in the history
Fix error handling in mana_create_rxq() when
cq->gdma_id >= gc->max_num_cqs.

Fixes: ca9c54d ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Link: https://lore.kernel.org/r/1633698691-31721-1-git-send-email-haiyangz@microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Haiyang Zhang authored and Jakub Kicinski committed Oct 9, 2021
1 parent 1f3e2e9 commit be04993
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/microsoft/mana/mana_en.c
Original file line number Diff line number Diff line change
@@ -1477,8 +1477,10 @@ static struct mana_rxq *mana_create_rxq(struct mana_port_context *apc,
if (err)
goto out;

if (cq->gdma_id >= gc->max_num_cqs)
if (WARN_ON(cq->gdma_id >= gc->max_num_cqs)) {
err = -EINVAL;
goto out;
}

gc->cq_table[cq->gdma_id] = cq->gdma_cq;

0 comments on commit be04993

Please sign in to comment.