[PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()

From: Wentao Liang

Date: Wed Sep 16 2026 - 05:20:24 EST


In i10nm_get_ddr_munits(), get_ddr_munit() returns a PCI device with
its reference count incremented. If ioremap() fails to map the MMIO
space of the memory controller, the function returns -ENODEV without
putting the reference held by mdev, leaking it.

Put the device reference before returning on the ioremap failure path.

Fixes: c545f5e41225 ("EDAC/i10nm: Skip the absent memory controllers")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/edac/i10nm_base.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c
index 63df35444214..b0cabe0daccd 100644
--- a/drivers/edac/i10nm_base.c
+++ b/drivers/edac/i10nm_base.c
@@ -847,6 +847,7 @@ static int i10nm_get_ddr_munits(void)

mbase = ioremap(base + off, size);
if (!mbase) {
+ pci_dev_put(mdev);
i10nm_printk(KERN_ERR, "Failed to ioremap 0x%llx\n",
base + off);
return -ENODEV;
--
2.34.1