[PATCH] EDAC/sb_edac: Fix pci_vtd reference leak in haswell_mci_bind_devs()
From: Wentao Liang
Date: Wed Sep 16 2026 - 05:22:35 EST
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@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
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