From: Wentao Liang <vulab@iscas.ac.cn>
To: akpm@linux-foundation.org
Cc: bp@alien8.de, dougthompson@xmission.com,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
mitake@clustcom.com, tony.luck@intel.com,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] EDAC/x38: Fix mci_pdev reference leak in x38_init_one()
Date: Wed, 16 Sep 2026 09:21:21 +0000 [thread overview]
Message-ID: <20260916092121.2000892-1-vulab@iscas.ac.cn> (raw)
In x38_init_one(), a reference to the PCI device is taken with
pci_dev_get() and stored in the global mci_pdev even when x38_probe1()
fails. On that path x38_registered keeps its initial value of 1, so
x38_exit() skips the pci_dev_put() and the reference is leaked.
Only take the reference after x38_probe1() succeeds.
Fixes: df8bc08c192f ("edac x38: new MC driver module")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/edac/x38_edac.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
index 292dda754c23..9c6542c4e3ee 100644
--- a/drivers/edac/x38_edac.c
+++ b/drivers/edac/x38_edac.c
@@ -423,10 +423,13 @@ static int x38_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return -EIO;
rc = x38_probe1(pdev, ent->driver_data);
+ if (rc)
+ return rc;
+
if (!mci_pdev)
mci_pdev = pci_dev_get(pdev);
- return rc;
+ return 0;
}
static void x38_remove_one(struct pci_dev *pdev)
--
2.34.1
reply other threads:[~2026-09-16 9:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260916092121.2000892-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dougthompson@xmission.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitake@clustcom.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.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®