* [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference
@ 2020-07-09 16:10 Rob Herring
2020-07-09 17:17 ` Anders Roxell
2020-07-09 19:21 ` Bjorn Helgaas
0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring @ 2020-07-09 16:10 UTC (permalink / raw)
To: linux-pci
Cc: Bjorn Helgaas, Will Deacon, Lorenzo Pieralisi, Anders Roxell,
linux-arm-kernel
Commit 2d716c37b5ce ("PCI: host-common: Use struct
pci_host_bridge.windows list directly") moved platform_set_drvdata()
before pci_host_probe() which results in the bridge->bus pointer being
NULL. Let's change the drvdata to the bridge struct instead to fix this.
Fixes: 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly")
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Cc: Will Deacon <will@kernel.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-host-common.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index f8f71d99e427..b76e55f495e4 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -83,7 +83,7 @@ int pci_host_common_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- platform_set_drvdata(pdev, bridge->bus);
+ platform_set_drvdata(pdev, bridge);
return pci_host_probe(bridge);
}
@@ -91,11 +91,11 @@ EXPORT_SYMBOL_GPL(pci_host_common_probe);
int pci_host_common_remove(struct platform_device *pdev)
{
- struct pci_bus *bus = platform_get_drvdata(pdev);
+ struct pci_host_bridge *bridge = platform_get_drvdata(pdev);
pci_lock_rescan_remove();
- pci_stop_root_bus(bus);
- pci_remove_root_bus(bus);
+ pci_stop_root_bus(bridge->bus);
+ pci_remove_root_bus(bridge->bus);
pci_unlock_rescan_remove();
return 0;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference
2020-07-09 16:10 [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference Rob Herring
@ 2020-07-09 17:17 ` Anders Roxell
2020-07-09 19:21 ` Bjorn Helgaas
1 sibling, 0 replies; 4+ messages in thread
From: Anders Roxell @ 2020-07-09 17:17 UTC (permalink / raw)
To: Rob Herring
Cc: Bjorn Helgaas, linux-pci, Lorenzo Pieralisi, Will Deacon, Linux ARM
On Thu, 9 Jul 2020 at 18:10, Rob Herring <robh@kernel.org> wrote:
>
> Commit 2d716c37b5ce ("PCI: host-common: Use struct
> pci_host_bridge.windows list directly") moved platform_set_drvdata()
> before pci_host_probe() which results in the bridge->bus pointer being
> NULL. Let's change the drvdata to the bridge struct instead to fix this.
>
> Fixes: 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly")
> Reported-by: Anders Roxell <anders.roxell@linaro.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
Thank you for the quick fix.
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Cheers,
Anders
> ---
> drivers/pci/controller/pci-host-common.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
> index f8f71d99e427..b76e55f495e4 100644
> --- a/drivers/pci/controller/pci-host-common.c
> +++ b/drivers/pci/controller/pci-host-common.c
> @@ -83,7 +83,7 @@ int pci_host_common_probe(struct platform_device *pdev)
> bridge->map_irq = of_irq_parse_and_map_pci;
> bridge->swizzle_irq = pci_common_swizzle;
>
> - platform_set_drvdata(pdev, bridge->bus);
> + platform_set_drvdata(pdev, bridge);
>
> return pci_host_probe(bridge);
> }
> @@ -91,11 +91,11 @@ EXPORT_SYMBOL_GPL(pci_host_common_probe);
>
> int pci_host_common_remove(struct platform_device *pdev)
> {
> - struct pci_bus *bus = platform_get_drvdata(pdev);
> + struct pci_host_bridge *bridge = platform_get_drvdata(pdev);
>
> pci_lock_rescan_remove();
> - pci_stop_root_bus(bus);
> - pci_remove_root_bus(bus);
> + pci_stop_root_bus(bridge->bus);
> + pci_remove_root_bus(bridge->bus);
> pci_unlock_rescan_remove();
>
> return 0;
> --
> 2.25.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference
2020-07-09 16:10 [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference Rob Herring
2020-07-09 17:17 ` Anders Roxell
@ 2020-07-09 19:21 ` Bjorn Helgaas
2020-07-10 10:56 ` Lorenzo Pieralisi
1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2020-07-09 19:21 UTC (permalink / raw)
To: Rob Herring
Cc: Lorenzo Pieralisi, Anders Roxell, linux-pci, Bjorn Helgaas,
Will Deacon, linux-arm-kernel
On Thu, Jul 09, 2020 at 10:10:02AM -0600, Rob Herring wrote:
> Commit 2d716c37b5ce ("PCI: host-common: Use struct
> pci_host_bridge.windows list directly") moved platform_set_drvdata()
> before pci_host_probe() which results in the bridge->bus pointer being
> NULL. Let's change the drvdata to the bridge struct instead to fix this.
>
> Fixes: 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly")
This commit is in -next, but not Linus's tree. Hopefully Lorenzo can
just squash this fix into it.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference
2020-07-09 19:21 ` Bjorn Helgaas
@ 2020-07-10 10:56 ` Lorenzo Pieralisi
0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-10 10:56 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Rob Herring, Anders Roxell, linux-pci, Bjorn Helgaas,
Will Deacon, linux-arm-kernel
On Thu, Jul 09, 2020 at 02:21:30PM -0500, Bjorn Helgaas wrote:
> On Thu, Jul 09, 2020 at 10:10:02AM -0600, Rob Herring wrote:
> > Commit 2d716c37b5ce ("PCI: host-common: Use struct
> > pci_host_bridge.windows list directly") moved platform_set_drvdata()
> > before pci_host_probe() which results in the bridge->bus pointer being
> > NULL. Let's change the drvdata to the bridge struct instead to fix this.
> >
> > Fixes: 2d716c37b5ce ("PCI: host-common: Use struct pci_host_bridge.windows list directly")
>
> This commit is in -next, but not Linus's tree. Hopefully Lorenzo can
> just squash this fix into it.
Done, updated my pci/misc branch accordingly.
Lorenzo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-10 10:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 16:10 [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference Rob Herring
2020-07-09 17:17 ` Anders Roxell
2020-07-09 19:21 ` Bjorn Helgaas
2020-07-10 10:56 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).