mint0x33/drivers/pci
Sascha Hauer b2c2911aa8 PCI/sysfs: Fix double free in error path
commit aa382ffa705bea9931ec92b6f3c70e1fdb372195 upstream.

When pci_create_attr() fails, pci_remove_resource_files() is called which
will iterate over the res_attr[_wc] arrays and frees every non NULL entry.
To avoid a double free here set the array entry only after it's clear we
successfully initialized it.

Fixes: b562ec8f74 ("PCI: Don't leak memory if sysfs_create_bin_file() fails")
Link: https://lore.kernel.org/r/20221007070735.GX986@pengutronix.de/
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-18 09:26:38 +01:00
..
dwc PCI: qcom: Fix unbalanced PHY init on probe errors 2022-06-14 16:54:02 +02:00
endpoint
host PCI: hv: Fix interrupt mapping for multi-MSI 2022-07-29 17:06:53 +02:00
hotplug PCI: pciehp: Clear cmd_busy bit in polling mode 2022-04-20 09:08:12 +02:00
pcie
switch
access.c PCI: Reduce warnings on possible RW1C corruption 2022-04-20 09:08:18 +02:00
ats.c
bus.c
ecam.c
host-bridge.c
hotplug-pci.c
htirq.c
iov.c
irq.c PCI: Check for alloc failure in pci_request_irq() 2023-01-18 09:26:21 +01:00
Kconfig
Makefile
mmap.c
msi.c PCI/MSI: Mask MSI-X vectors only on success 2021-12-22 09:18:00 +01:00
of.c
pci-acpi.c
pci-driver.c
pci-label.c
pci-mid.c
pci-stub.c
pci-sysfs.c PCI/sysfs: Fix double free in error path 2023-01-18 09:26:38 +01:00
pci.c PCI: Fix pci_device_is_present() for VFs by checking PF 2023-01-18 09:26:38 +01:00
pci.h
probe.c
proc.c
quirks.c PCI: Add ACS quirk for Broadcom BCM5750x NICs 2022-08-25 11:11:35 +02:00
remove.c
rom.c
search.c
setup-bus.c
setup-irq.c
setup-res.c PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge 2022-10-26 13:16:56 +02:00
slot.c
syscall.c PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure 2021-09-22 11:45:25 +02:00
vc.c
vpd.c
xen-pcifront.c