linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: Rob Herring <robh@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Will Deacon <will@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] PCI: host-common: Fix driver remove NULL bridge->bus dereference
Date: Thu, 9 Jul 2020 19:17:52 +0200	[thread overview]
Message-ID: <CADYN=9JhwHYPOVanqwOER71G__M1UPVDbE_32eChOKWVYb+fZQ@mail.gmail.com> (raw)
In-Reply-To: <20200709161002.439699-1-robh@kernel.org>

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

  reply	other threads:[~2020-07-09 17:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-07-09 19:21 ` Bjorn Helgaas
2020-07-10 10:56   ` Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADYN=9JhwHYPOVanqwOER71G__M1UPVDbE_32eChOKWVYb+fZQ@mail.gmail.com' \
    --to=anders.roxell@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robh@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).