From: Andrew Donnellan <hidden> Date: 2016-08-18 07:36:06
When cxl removes a vPHB, it's possible that the pci_controller may be freed
before all references to the devices on the vPHB have been released. This
in turn causes an invalid memory access when the devices are eventually
released, as pcibios_release_device() attempts to call the phb's
release_device hook.
In cxl_pci_vphb_remove(), remove the existing call to
pcibios_free_controller(). Instead, use
pcibios_free_controller_deferred() to free the pci_controller after all
devices have been released. Export pci_set_host_bridge_release() so we can
do this.
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
---
This patch requires http://patchwork.ozlabs.org/patch/658324/. It should go
through the powerpc tree.
---
drivers/misc/cxl/vphb.c | 10 +++++++++-
drivers/pci/host-bridge.c | 1 +
2 files changed, 10 insertions(+), 1 deletion(-)
@@ -230,6 +230,11 @@ int cxl_pci_vphb_add(struct cxl_afu *afu)if(phb->bus==NULL)return-ENXIO;+/* Set release hook on root bus */+pci_set_host_bridge_release(to_pci_host_bridge(phb->bus->bridge),+pcibios_free_controller_deferred,+(void*)phb);+/* Claim resources. This might need some rework as well depending*whetherwearedoingprobe-onlyornot,likeassigningunassigned*resourcesetc...
From: Matthew R. Ochs <hidden> Date: 2016-08-18 17:02:59
On Aug 18, 2016, at 2:35 AM, Andrew Donnellan =
[off-list ref] wrote:
=20
When cxl removes a vPHB, it's possible that the pci_controller may be =
freed
before all references to the devices on the vPHB have been released. =
This
in turn causes an invalid memory access when the devices are =
eventually
released, as pcibios_release_device() attempts to call the phb's
release_device hook.
=20
In cxl_pci_vphb_remove(), remove the existing call to
pcibios_free_controller(). Instead, use
pcibios_free_controller_deferred() to free the pci_controller after =
all
devices have been released. Export pci_set_host_bridge_release() so we =
can
do this.
=20
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
drivers/misc/cxl/vphb.c:235:9: error: 'pcibios_free_controller_deferred' undeclared (first use in this function)
pcibios_free_controller_deferred,
^
drivers/misc/cxl/vphb.c:235:9: note: each undeclared identifier is reported only once for each function it appears in
vim +/pcibios_free_controller_deferred +235 drivers/misc/cxl/vphb.c
229 pcibios_scan_phb(phb);
230 if (phb->bus == NULL)
231 return -ENXIO;
232
233 /* Set release hook on root bus */
234 pci_set_host_bridge_release(to_pci_host_bridge(phb->bus->bridge),
> 235 pcibios_free_controller_deferred,
236 (void *) phb);
237
238 /* Claim resources. This might need some rework as well depending
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: Andrew Donnellan <hidden> Date: 2016-08-30 01:58:53
Hi stable team,
The following patch, which ended up upstream as
6f38a8b9a45833495dc878c335c5431cd98a16ed:
On 18/08/16 17:35, Andrew Donnellan wrote:
When cxl removes a vPHB, it's possible that the pci_controller may be freed
before all references to the devices on the vPHB have been released. This
in turn causes an invalid memory access when the devices are eventually
released, as pcibios_release_device() attempts to call the phb's
release_device hook.
In cxl_pci_vphb_remove(), remove the existing call to
pcibios_free_controller(). Instead, use
pcibios_free_controller_deferred() to free the pci_controller after all
devices have been released. Export pci_set_host_bridge_release() so we can
do this.
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Donnellan <redacted>
---
This patch requires http://patchwork.ozlabs.org/patch/658324/. It should go
through the powerpc tree.
This depends on 2dd9c11b9d4dfbd6c070eab7b81197f65e82f1a0 which didn't
end up being tagged as cc: stable. It also ended up being applied in the
wrong order in the powerpc/fixes tree...
Thanks,
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2016-08-30 02:37:00
On Tue, 2016-08-30 at 11:58 +1000, Andrew Donnellan wrote:
Hi stable team,
The following patch, which ended up upstream as
6f38a8b9a45833495dc878c335c5431cd98a16ed:
On 18/08/16 17:35, Andrew Donnellan wrote:
quoted
When cxl removes a vPHB, it's possible that the pci_controller may be freed
before all references to the devices on the vPHB have been released. This
in turn causes an invalid memory access when the devices are eventually
released, as pcibios_release_device() attempts to call the phb's
release_device hook.
In cxl_pci_vphb_remove(), remove the existing call to
pcibios_free_controller(). Instead, use
pcibios_free_controller_deferred() to free the pci_controller after all
devices have been released. Export pci_set_host_bridge_release() so we can
do this.
Cc: stable@vger.kernel.org
This depends on 2dd9c11b9d4dfbd6c070eab7b81197f65e82f1a0 which didn't
end up being tagged as cc: stable. It also ended up being applied in the
wrong order in the powerpc/fixes tree...
My fault. Best at this point is to also apply 2dd9c11b9d4dfbd6c070eab7b81197f65e82f1a0
to stable.
Cheers,
Ben.