From: Maxim Levitsky <mlevitsk@redhat.com>
To: kvm@vger.kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
Haiyang Zhang <haiyangz@microsoft.com>,
Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>,
linux-hyperv@vger.kernel.org, Dexuan Cui <decui@microsoft.com>,
Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org,
Konstantin Taranov <kotaranov@microsoft.com>,
Leon Romanovsky <leon@kernel.org>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
Shradha Gupta <shradhagupta@linux.microsoft.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Long Li <longli@microsoft.com>, Yury Norov <yury.norov@gmail.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
Michael Kelley <mhklinux@outlook.com>
Subject: [PATCH v2 2/2] net: mana: Fix irq_contexts memory leak in mana_gd_setup_irqs
Date: Mon, 9 Dec 2024 12:57:51 -0500 [thread overview]
Message-ID: <20241209175751.287738-3-mlevitsk@redhat.com> (raw)
In-Reply-To: <20241209175751.287738-1-mlevitsk@redhat.com>
gc->irq_contexts is not freeded if one of the later operations
fail.
Suggested-by: Michael Kelley <mhklinux@outlook.com>
Fixes: 8afefc361209 ("net: mana: Assigning IRQ affinity on HT cores")
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
drivers/net/ethernet/microsoft/mana/gdma_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index aba188f9f10f..6297c0869cd6 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -1318,7 +1318,7 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
GFP_KERNEL);
if (!gc->irq_contexts) {
err = -ENOMEM;
- goto free_irq_vector;
+ goto free_irq_array;
}
for (i = 0; i < nvec; i++) {
@@ -1388,8 +1388,9 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
}
kfree(gc->irq_contexts);
- kfree(irqs);
gc->irq_contexts = NULL;
+free_irq_array:
+ kfree(irqs);
free_irq_vector:
cpus_read_unlock();
pci_free_irq_vectors(pdev);
--
2.26.3
next prev parent reply other threads:[~2024-12-09 17:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 17:57 [PATCH v2 0/2] MANA: Fix few memory leaks in mana_gd_setup_irqs Maxim Levitsky
2024-12-09 17:57 ` [PATCH v2 1/2] net: mana: Fix memory leak " Maxim Levitsky
2024-12-10 6:13 ` Michal Swiatkowski
2024-12-10 6:17 ` Michal Swiatkowski
2024-12-10 8:05 ` Kalesh Anakkur Purayil
2024-12-09 17:57 ` Maxim Levitsky [this message]
2024-12-10 6:19 ` [PATCH v2 2/2] net: mana: Fix irq_contexts " Michal Swiatkowski
2024-12-10 8:07 ` Kalesh Anakkur Purayil
2024-12-10 6:23 ` [PATCH v2 0/2] MANA: Fix few memory leaks " Michal Swiatkowski
2024-12-10 10:24 ` Saurabh Singh Sengar
2024-12-11 18:34 ` Yury Norov
2024-12-12 4:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241209175751.287738-3-mlevitsk@redhat.com \
--to=mlevitsk@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mhklinux@outlook.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=schakrabarti@linux.microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=wei.liu@kernel.org \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).