2021-10-07 22:50:05

by Haiyang Zhang

[permalink] [raw]
Subject: [PATCH net] net: mana: Fix error handling in mana_create_rxq()

Fix error handling in mana_create_rxq() when
cq->gdma_id >= gc->max_num_cqs.

Signed-off-by: Haiyang Zhang <[email protected]>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 9a871192ca96..d65697c239c8 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;

--
2.25.1


2021-10-08 02:29:37

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net] net: mana: Fix error handling in mana_create_rxq()

On Thu, 7 Oct 2021 15:45:33 -0700 Haiyang Zhang wrote:
> Fix error handling in mana_create_rxq() when
> cq->gdma_id >= gc->max_num_cqs.
>
> Signed-off-by: Haiyang Zhang <[email protected]>

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")

2021-10-08 13:06:57

by Haiyang Zhang

[permalink] [raw]
Subject: RE: [PATCH net] net: mana: Fix error handling in mana_create_rxq()



> -----Original Message-----
> From: Jakub Kicinski <[email protected]>
> Sent: Thursday, October 7, 2021 10:28 PM
> To: Haiyang Zhang <[email protected]>
> Cc: [email protected]; [email protected]; KY Srinivasan
> <[email protected]>; Stephen Hemminger <[email protected]>; Paul
> Rosswurm <[email protected]>; Shachar Raindel
> <[email protected]>; [email protected]; vkuznets <[email protected]>;
> [email protected]; [email protected]
> Subject: Re: [PATCH net] net: mana: Fix error handling in
> mana_create_rxq()
>
> On Thu, 7 Oct 2021 15:45:33 -0700 Haiyang Zhang wrote:
> > Fix error handling in mana_create_rxq() when
> > cq->gdma_id >= gc->max_num_cqs.
> >
> > Signed-off-by: Haiyang Zhang <[email protected]>
>
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure
> Network Adapter (MANA)")

I will add "Fixes" line.

Thanks,
- Haiyang