linux-brain/drivers/pci
Geert Uytterhoeven 473900cd52 PCI: rcar: Fix use-after-free in probe error path
[ Upstream commit 0c31f1d7be ]

If CONFIG_DEBUG_SLAB=y, and no PCIe card is inserted, the kernel crashes
during probe on r8a7791/koelsch:

  rcar-pcie fe000000.pcie: PCIe link down
  Unable to handle kernel paging request at virtual address 6b6b6b6b

(seeing this message requires earlycon and keep_bootcon).

Indeed, pci_free_host_bridge() frees the PCI host bridge, including the
embedded rcar_pcie object, so pci_free_resource_list() must not be called
afterwards.

To fix this, move the call to pci_free_resource_list() up, and update the
label name accordingly.

Fixes: ddd535f1ea ("PCI: rcar: Fix memory leak when no PCIe card is inserted")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-25 11:08:03 +01:00
..
dwc PCI: keystone: Fix interrupt-controller-node lookup 2018-02-22 15:42:27 +01:00
endpoint PCI: endpoint: Use correct "end of test" interrupt 2017-09-20 13:56:06 -05:00
host PCI: rcar: Fix use-after-free in probe error path 2018-02-25 11:08:03 +01:00
hotplug License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcie PCI/AER: Report non-fatal errors only to the affected endpoint 2017-12-25 14:26:27 +01:00
switch Merge branch 'pci/switchtec' into next 2017-07-02 18:51:10 -05:00
access.c PCI: Provide Kconfig option for lockless config space accessors 2017-06-28 22:32:56 +02:00
ats.c PCI: Restore PRI and PASID state after Function-Level Reset 2017-05-30 15:40:50 -05:00
bus.c PCI: Autosense device removal in pci_bridge_d3_update() 2016-11-17 18:44:56 -06:00
ecam.c PCI: ECAM: Map config region with pci_remap_cfgspace() 2017-04-24 13:53:14 -05:00
host-bridge.c cxl: use pcibios_free_controller_deferred() when removing vPHBs 2016-08-22 11:09:33 +10:00
hotplug-pci.c PCI: Remove unnecessary __ref annotations 2014-04-29 17:36:44 -06:00
htirq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iov.c PCI: Create SR-IOV virtfn/physfn links before attaching driver 2017-12-25 14:26:26 +01:00
irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig PCI: Provide Kconfig option for lockless config space accessors 2017-06-28 22:32:56 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmap.c PCI: Add I/O BAR support to generic pci_mmap_resource_range() 2017-04-20 08:47:47 -05:00
msi.c pci-v4.14-changes 2017-09-08 15:47:43 -07:00
of.c PCI/MSI: Use of_msi_get_domain instead of open-coded "msi-parent" parsing 2015-10-16 13:07:14 +01:00
pci-acpi.c ACPI / PCI / PM: Rework acpi_pci_propagate_wakeup() 2017-08-01 14:05:03 +02:00
pci-driver.c PCI / PM: Force devices to D0 in pci_pm_thaw_noirq() 2017-12-29 17:53:47 +01:00
pci-label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-mid.c PCI / PM: Simplify device wakeup settings code 2017-06-28 01:52:45 +02:00
pci-stub.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
pci-sysfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci.c PCI: Avoid bus reset if bridge itself is broken 2017-12-25 14:26:25 +01:00
pci.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
probe.c PCI: Do not allocate more buses than available in parent 2017-12-20 10:10:24 +01:00
proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quirks.c PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode 2018-02-22 15:42:27 +01:00
remove.c PCI: Detach driver before procfs & sysfs teardown on device remove 2017-12-20 10:10:32 +01:00
rom.c PCI: Add comments about ROM BAR updating 2016-11-29 18:05:09 -06:00
search.c PCI: Add device flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT 2017-04-13 18:49:50 -05:00
setup-bus.c PCI: Fix calculation of bridge window's size and alignment 2017-04-18 14:47:20 -05:00
setup-irq.c PCI: Inline and remove pcibios_update_irq() 2017-08-10 12:49:57 -05:00
setup-res.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slot.c locking/atomic, kref: Add kref_read() 2017-01-14 11:37:18 +01:00
syscall.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vc.c PCI: Fix unaligned accesses in VC code 2016-06-20 13:24:20 -05:00
vpd.c
xen-pcifront.c xen: make use of xenbus_read_unsigned() in xen-pcifront 2016-11-07 13:55:26 +01:00