EDAC/ie31200: Disable PCI device when probing fails

ie31200_init_one() enables the PCI device before calling ie31200_probe1().
If probing fails, it returns without balancing the successful enable,
leaving the PCI enable count elevated.

Call pci_disable_device() on that failure path. This also covers the
direct ie31200_init_one() call from the module initialization fallback,
while preserving the existing return values and successful probe path.

This issue was identified during our ongoing static-analysis research while
reviewing kernel code.

Assisted-by: LLM
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260913212500.60272-1-mhun512@gmail.com
This commit is contained in:
Myeonghun Pak 2026-09-13 17:25:00 -04:00 committed by Borislav Petkov (AMD)
parent 30713abb1e
commit 68a3e57814

View File

@ -660,7 +660,9 @@ static int ie31200_init_one(struct pci_dev *pdev,
if (pci_enable_device(pdev) < 0)
return -EIO;
rc = ie31200_probe1(pdev, (struct res_config *)ent->driver_data);
if (rc == 0 && !mci_pdev)
if (rc)
pci_disable_device(pdev);
else if (!mci_pdev)
mci_pdev = pci_dev_get(pdev);
return rc;