[PATCH 0/2] PCI: Fix potential double-free and add error logging

From: Jinhui Guo

Date: Fri Oct 10 2025 - 05:31:27 EST


Hi all,

Two patches fix pci sysfs/procfs issues:

1. Avoid a double-free in pci_remove_resource_files() by clearing
pdev->res_attr[i] and pdev->res_attr_wc[i] to NULL after kfree().
2. To make PCI bring-up failures easier to diagnose, log the errno
returned by pci_create_sysfs_dev_files() and pci_proc_attach_device()
in pci_bus_add_device().

Thanks,
Jinhui

----
Jinhui Guo (2):
PCI/sysfs: Fix potential double-free in pci_remove_resource_files()
PCI: Print the error code when PCI sysfs or procfs creation fails

drivers/pci/bus.c | 9 +++++++--
drivers/pci/pci-sysfs.c | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)

--
2.20.1