netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
@ 2022-12-10 17:35 Christophe JAILLET
  2022-12-12  6:47 ` [EXT] " Geethasowjanya Akula
  2022-12-12 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-12-10 17:35 UTC (permalink / raw)
  To: Sunil Goutham, Linu Cherian, Geetha sowjanya, Jerin Jacob,
	hariprasad, Subbaraya Sundeep, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Vamsi Attunuru
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

In mcs_register_interrupts(), a call to request_irq() is not balanced by a
corresponding free_irq(), neither in the error handling path, nor in the
remove function.

Add the missing calls.

Fixes: 6c635f78c474 ("octeontx2-af: cn10k: mcs: Handle MCS block interrupts")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is untested and speculative.
I'm always reluctant to send patches around irq management, because it is
sometimes tricky.
Review with care!

Maybe introducing a mcs_unregister_interrupts() function would be cleaner
and more future proof.
---
 drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
index c0bedf402da9..f68a6a0e3aa4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
@@ -1184,10 +1184,13 @@ static int mcs_register_interrupts(struct mcs *mcs)
 	mcs->tx_sa_active = alloc_mem(mcs, mcs->hw->sc_entries);
 	if (!mcs->tx_sa_active) {
 		ret = -ENOMEM;
-		goto exit;
+		goto free_irq;
 	}
 
 	return ret;
+
+free_irq:
+	free_irq(pci_irq_vector(mcs->pdev, MCS_INT_VEC_IP), mcs);
 exit:
 	pci_free_irq_vectors(mcs->pdev);
 	mcs->num_vec = 0;
@@ -1589,6 +1592,7 @@ static void mcs_remove(struct pci_dev *pdev)
 
 	/* Set MCS to external bypass */
 	mcs_set_external_bypass(mcs, true);
+	free_irq(pci_irq_vector(pdev, MCS_INT_VEC_IP), mcs);
 	pci_free_irq_vectors(pdev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [EXT] [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
  2022-12-10 17:35 [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions Christophe JAILLET
@ 2022-12-12  6:47 ` Geethasowjanya Akula
  2022-12-12 23:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Geethasowjanya Akula @ 2022-12-12  6:47 UTC (permalink / raw)
  To: Christophe JAILLET, Sunil Kovvuri Goutham, Linu Cherian,
	Jerin Jacob Kollanukkaran, Hariprasad Kelam,
	Subbaraya Sundeep Bhatta, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Vamsi Krishna Attunuru
  Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	netdev@vger.kernel.org

Ack.
Thanks for the patch.

Geetha.

________________________________________
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Sent: Saturday, December 10, 2022 11:05 PM
To: Sunil Kovvuri Goutham; Linu Cherian; Geethasowjanya Akula; Jerin Jacob Kollanukkaran; Hariprasad Kelam; Subbaraya Sundeep Bhatta; David S. Miller; Eric Dumazet; Jakub Kicinski; Paolo Abeni; Vamsi Krishna Attunuru
Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Christophe JAILLET; netdev@vger.kernel.org
Subject: [EXT] [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions

External Email

----------------------------------------------------------------------
In mcs_register_interrupts(), a call to request_irq() is not balanced by a
corresponding free_irq(), neither in the error handling path, nor in the
remove function.

Add the missing calls.

Fixes: 6c635f78c474 ("octeontx2-af: cn10k: mcs: Handle MCS block interrupts")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is untested and speculative.
I'm always reluctant to send patches around irq management, because it is
sometimes tricky.
Review with care!

Maybe introducing a mcs_unregister_interrupts() function would be cleaner
and more future proof.
---
 drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
index c0bedf402da9..f68a6a0e3aa4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c
@@ -1184,10 +1184,13 @@ static int mcs_register_interrupts(struct mcs *mcs)
        mcs->tx_sa_active = alloc_mem(mcs, mcs->hw->sc_entries);
        if (!mcs->tx_sa_active) {
                ret = -ENOMEM;
-               goto exit;
+               goto free_irq;
        }

        return ret;
+
+free_irq:
+       free_irq(pci_irq_vector(mcs->pdev, MCS_INT_VEC_IP), mcs);
 exit:
        pci_free_irq_vectors(mcs->pdev);
        mcs->num_vec = 0;
@@ -1589,6 +1592,7 @@ static void mcs_remove(struct pci_dev *pdev)

        /* Set MCS to external bypass */
        mcs_set_external_bypass(mcs, true);
+       free_irq(pci_irq_vector(pdev, MCS_INT_VEC_IP), mcs);
        pci_free_irq_vectors(pdev);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
--
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
  2022-12-10 17:35 [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions Christophe JAILLET
  2022-12-12  6:47 ` [EXT] " Geethasowjanya Akula
@ 2022-12-12 23:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-12 23:10 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: sgoutham, lcherian, gakula, jerinj, hkelam, sbhatta, davem,
	edumazet, kuba, pabeni, vattunuru, linux-kernel, kernel-janitors,
	netdev

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 10 Dec 2022 18:35:00 +0100 you wrote:
> In mcs_register_interrupts(), a call to request_irq() is not balanced by a
> corresponding free_irq(), neither in the error handling path, nor in the
> remove function.
> 
> Add the missing calls.
> 
> Fixes: 6c635f78c474 ("octeontx2-af: cn10k: mcs: Handle MCS block interrupts")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> [...]

Here is the summary with links:
  - octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
    https://git.kernel.org/netdev/net/c/87c978123ef1

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-12 23:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-10 17:35 [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions Christophe JAILLET
2022-12-12  6:47 ` [EXT] " Geethasowjanya Akula
2022-12-12 23:10 ` patchwork-bot+netdevbpf

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).