RE: [PATCH] EDAC/sb_edac: Fix pci_vtd reference leak in broadwell_mci_bind_devs()
From: Leo Zhuo
Date: Wed Sep 16 2026 - 10:56:11 EST
> From: Wentao Liang <vulab@xxxxxxxxxxx>
> [...]
> Subject: [PATCH] EDAC/sb_edac: Fix pci_vtd reference leak in
> broadwell_mci_bind_devs()
>
>
> In broadwell_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: 1f39581a9a7a ("sb_edac: Add support for Broadwell-DE processor")
> 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
> 5075c703e19e..7ec29e50f5d7 100644
> --- a/drivers/edac/sb_edac.c
> +++ b/drivers/edac/sb_edac.c
> @@ -2929,6 +2929,8 @@ static int broadwell_mci_bind_devs(struct mem_ctl_info
> *mci,
> return 0;
>
> enodev:
> + pci_dev_put(pvt->info.pci_vtd);
> + pvt->info.pci_vtd = NULL;
See comments:
https://lore.kernel.org/all/CY8PR12MB72909C59B4374AB917E1D99DD1B92@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/