diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2021-10-08 16:11:31 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-10-09 03:00:04 +0300 |
commit | be0499369d6376e70b5b80bbced94c0c32d508b1 (patch) | |
tree | e9ad4dcf031e819c000efc60f6b48090835f5ede /drivers/net/ethernet/microsoft | |
parent | 1f3e2e97c003f80c4b087092b225c8787ff91e4d (diff) | |
download | linux-be0499369d6376e70b5b80bbced94c0c32d508b1.tar.xz |
net: mana: Fix error handling in mana_create_rxq()
Fix error handling in mana_create_rxq() when
cq->gdma_id >= gc->max_num_cqs.
Fixes: ca9c54d2d6a5 ("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>
Diffstat (limited to 'drivers/net/ethernet/microsoft')
-rw-r--r-- | drivers/net/ethernet/microsoft/mana/mana_en.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 1b21030308e5..030ae89f3a33 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -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; |