]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
PCI: iproc: Save host bridge window resource in struct iproc_pcie
authorBjorn Helgaas <bhelgaas@google.com>
Thu, 9 Mar 2017 17:27:07 +0000 (11:27 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:11:25 +0000 (10:11 +0200)
commitfa2931aff9262b157f1814abfc48bd89a044b6be
tree5c90147f5b443a8d100f735f2ac6c5fef69425e2
parenta378be6d349ed6a98dc72ab2da20c7382d4a3eff
PCI: iproc: Save host bridge window resource in struct iproc_pcie

BugLink: http://bugs.launchpad.net/bugs/1681875
commit 6e347b5e05ea2ac4ac467a5a1cfaebb2c7f06f80 upstream.

The host bridge memory window resource is inserted into the iomem_resource
tree and cannot be deallocated until the host bridge itself is removed.

Previously, the window was on the stack, which meant the iomem_resource
entry pointed into the stack and was corrupted as soon as the probe
function returned, which caused memory corruption and errors like this:

  pcie_iproc_bcma bcma0:8: resource collision: [mem 0x40000000-0x47ffffff] conflicts with PCIe MEM space [mem 0x40000000-0x47ffffff]

Move the memory window resource from the stack into struct iproc_pcie so
its lifetime matches that of the host bridge.

Fixes: c3245a566400 ("PCI: iproc: Request host bridge window resources")
Reported-and-tested-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/pci/host/pcie-iproc-bcma.c
drivers/pci/host/pcie-iproc-platform.c
drivers/pci/host/pcie-iproc.h