2021-06-20 13:44:55

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] net: mana: Fix a memory leak in an error handling path in 'mana_create_txq()'

If this test fails we must free some resources as in all the other error
handling paths of this function.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Signed-off-by: Christophe JAILLET <[email protected]>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 46aee2c49f1b..fff78900fc8a 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1230,8 +1230,10 @@ static int mana_create_txq(struct mana_port_context *apc,

cq->gdma_id = cq->gdma_cq->id;

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

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

--
2.30.2


2021-06-20 16:59:30

by Dexuan Cui

[permalink] [raw]
Subject: RE: [PATCH] net: mana: Fix a memory leak in an error handling path in 'mana_create_txq()'

> From: Christophe JAILLET <[email protected]>
> Sent: Sunday, June 20, 2021 6:43 AM
>
> If this test fails we must free some resources as in all the other error
> handling paths of this function.
>
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network
> Adapter (MANA)")
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---

Reviewed-by: Dexuan Cui <[email protected]>

2021-06-21 21:50:49

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH] net: mana: Fix a memory leak in an error handling path in 'mana_create_txq()'

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 20 Jun 2021 15:43:28 +0200 you wrote:
> If this test fails we must free some resources as in all the other error
> handling paths of this function.
>
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Signed-off-by: Christophe JAILLET <[email protected]>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)

Here is the summary with links:
- net: mana: Fix a memory leak in an error handling path in 'mana_create_txq()'
https://git.kernel.org/netdev/net/c/b90788459cd6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html