mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geethasowjanya Akula <gakula@marvell.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Linu Cherian <lcherian@marvell.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Hariprasad Kelam <hkelam@marvell.com>,
	Subbaraya Sundeep Bhatta <sbhatta@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Vamsi Krishna Attunuru <vattunuru@marvell.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [EXT] [PATCH] octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove functions
Date: Mon, 12 Dec 2022 06:47:12 +0000	[thread overview]
Message-ID: <DM6PR18MB260274199FF752A2E5307C0DCDE29@DM6PR18MB2602.namprd18.prod.outlook.com> (raw)
In-Reply-To: <69f153db5152a141069f990206e7389f961d41ec.1670693669.git.christophe.jaillet@wanadoo.fr>

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


  reply	other threads:[~2022-12-12  6:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 17:35 Christophe JAILLET
2022-12-12  6:47 ` Geethasowjanya Akula [this message]
2022-12-12 23:10 ` 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=DM6PR18MB260274199FF752A2E5307C0DCDE29@DM6PR18MB2602.namprd18.prod.outlook.com \
    --to=gakula@marvell.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=vattunuru@marvell.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

all inboxes | Powered by JetHome®