WSL2-Linux-Kernel/drivers/pci
Sascha Hauer 657b440a27 PCI/sysfs: Fix double free in error path
commit aa382ffa70 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-12 11:58:58 +01:00
..
controller PCI: vmd: Disable MSI remapping after suspend 2022-12-31 13:14:23 +01:00
endpoint PCI: pci-epf-test: Register notifier if only core_init_notifier is enabled 2022-12-31 13:14:22 +01:00
hotplug PCI: pciehp: Ignore Link Down/Up caused by error-induced Hot Reset 2022-07-12 16:34:52 +02:00
pcie Revert "PCI/portdrv: Don't disable AER reporting in get_port_device_capability()" 2022-09-05 10:30:06 +02:00
switch
Kconfig PCI: only build xen-pcifront in PV-enabled environments 2021-09-20 17:01:11 +02:00
Makefile
access.c PCI: Reduce warnings on possible RW1C corruption 2022-04-08 14:23:37 +02:00
ats.c PCI: Allow PASID on fake PCIe devices without TLP prefixes 2021-08-26 14:21:42 -05:00
bus.c
ecam.c
host-bridge.c PCI: VMD: ACPI: Make ACPI companion lookup work for VMD bus 2021-09-02 17:59:58 +02:00
iov.c Merge branch 'pci/virtualization' 2021-07-06 10:56:26 -05:00
irq.c PCI: Check for alloc failure in pci_request_irq() 2022-12-31 13:14:24 +01:00
mmap.c
msi.c PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() 2022-01-27 11:04:11 +01:00
of.c PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges' 2021-08-04 12:20:00 +01:00
p2pdma.c memremap: remove support for external pgmap refcounts 2022-08-17 14:23:43 +02:00
pci-acpi.c PCI/ACPI: Allow D3 only if Root Port can signal and wake from D3 2022-06-09 10:23:04 +02:00
pci-bridge-emul.c PCI: pci-bridge-emul: Add definitions for missing capabilities registers 2022-05-12 12:30:27 +02:00
pci-bridge-emul.h PCI: pci-bridge-emul: Add PCIe Root Capabilities Register 2021-08-05 10:51:49 +01:00
pci-driver.c VFIO update for v5.15-rc1 2021-09-02 13:41:33 -07:00
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c PCI/sysfs: Fix double free in error path 2023-01-12 11:58:58 +01:00
pci.c PCI: Fix pci_device_is_present() for VFs by checking PF 2023-01-12 11:58:58 +01:00
pci.h pci-v5.15-changes 2021-09-07 19:13:42 -07:00
probe.c Merge branch 'remotes/lorenzo/pci/hyper-v' 2021-09-02 14:56:47 -05:00
proc.c pci-v5.15-changes 2021-09-07 19:13:42 -07:00
quirks.c PCI: Add ACS quirk for Broadcom BCM5750x NICs 2022-08-25 11:40:30 +02:00
remove.c PCI: Remove reset_fn field from pci_dev 2021-08-17 17:44:38 -05:00
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 12:34:24 +02:00
slot.c
syscall.c PCI: Return int from pciconfig_read() syscall 2021-08-03 16:55:48 -05:00
vc.c
vpd.c PCI/VPD: Defer VPD sizing until first access 2021-09-15 16:26:13 -05:00
xen-pcifront.c Merge branch 'stable/for-linus-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb 2021-09-03 10:34:44 -07:00