mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] EDAC/sb_edac: Fix pci_vtd reference leak in haswell_mci_bind_devs()
@ 2026-09-16  9:20 Wentao Liang
  2026-09-16 14:37 ` Leo Zhuo
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16  9:20 UTC (permalink / raw)
  To: aris
  Cc: bp, linux-edac, linux-kernel, mchehab, qiuxu.zhuo, tony.luck,
	Wentao Liang, stable

In haswell_mci_bind_devs(), a reference to the VT-d device is taken
with pci_get_device() and stored in pvt->info.pci_vtd.  If one of the
required devices is missing, the function returns -ENODEV without
putting that reference, and the caller frees the mem_ctl_info along
with its private data, leaking the reference.

Put the device reference before returning on the error path.

Fixes: 50d1bb93672f ("sb_edac: add support for Haswell based systems")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/edac/sb_edac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 7b282dfd093f..5075c703e19e 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -2846,6 +2846,8 @@ static int haswell_mci_bind_devs(struct mem_ctl_info *mci,
 	return 0;
 
 enodev:
+	pci_dev_put(pvt->info.pci_vtd);
+	pvt->info.pci_vtd = NULL;
 	sbridge_printk(KERN_ERR, "Some needed devices are missing\n");
 	return -ENODEV;
 }
-- 
2.34.1


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

end of thread, other threads:[~2026-09-16 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  9:20 [PATCH] EDAC/sb_edac: Fix pci_vtd reference leak in haswell_mci_bind_devs() Wentao Liang
2026-09-16 14:37 ` Leo Zhuo

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®