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

Subsystems: hyper-v/azure core and drivers, networking drivers, the rest

STALE1879d

3 messages, 3 authors, 2021-06-21 · open the first message on its own page

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

From: Christophe JAILLET <hidden>
Date: 2021-06-20 13:43:38

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 <redacted>
---
 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

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

From: Dexuan Cui <decui@microsoft.com>
Date: 2021-06-20 16:58:46

From: Christophe JAILLET <redacted>
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 <redacted>
---
Reviewed-by: Dexuan Cui <decui@microsoft.com>

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

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-06-21 21:50:13

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 <redacted>
---
 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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help