* [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()
@ 2026-09-16 9:12 Wentao Liang
2026-09-16 14:31 ` Leo Zhuo
2026-09-17 23:35 ` Luck, Tony
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-16 9:12 UTC (permalink / raw)
To: bp; +Cc: linux-edac, linux-kernel, qiuxu.zhuo, tony.luck, Wentao Liang, stable
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@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()
2026-09-16 9:12 [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits() Wentao Liang
@ 2026-09-16 14:31 ` Leo Zhuo
2026-09-17 23:35 ` Luck, Tony
1 sibling, 0 replies; 3+ messages in thread
From: Leo Zhuo @ 2026-09-16 14:31 UTC (permalink / raw)
To: Wentao Liang, bp; +Cc: linux-edac, linux-kernel, Leo Zhuo, tony.luck, stable
> From: Wentao Liang <vulab@iscas.ac.cn>
> Sent: Wednesday, September 16, 2026 5:13 PM
> To: bp@alien8.de
> Cc: linux-edac@vger.kernel.org; linux-kernel@vger.kernel.org;
> qiuxu.zhuo@intel.com; tony.luck@intel.com; Wentao Liang <vulab@iscas.ac.cn>;
> stable@vger.kernel.org
> Subject: [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()
>
> External email: Use caution opening links or attachments
>
>
> 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@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
LGTM,
Reviewed-by: Qiuxu Zhuo <qzhuo@nvidia.com>
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()
2026-09-16 9:12 [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits() Wentao Liang
2026-09-16 14:31 ` Leo Zhuo
@ 2026-09-17 23:35 ` Luck, Tony
1 sibling, 0 replies; 3+ messages in thread
From: Luck, Tony @ 2026-09-17 23:35 UTC (permalink / raw)
To: Wentao Liang; +Cc: bp, linux-edac, linux-kernel, qiuxu.zhuo, stable
On Wed, Sep 16, 2026 at 09:12:51AM +0000, Wentao Liang wrote:
> 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.
Applied. Thanks.
-Tony
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-17 23:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 9:12 [PATCH] EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits() Wentao Liang
2026-09-16 14:31 ` Leo Zhuo
2026-09-17 23:35 ` Luck, Tony
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®