[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAErSpo5XvTHFf+ZO0GAxKm0xk+fo9Hm_G6Ebz1UmMkLUi8CPyw@mail.gmail.com>
Date: Wed, 12 Jun 2013 15:54:36 -0600
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: Radim Krčmář <rkrcmar@...hat.com>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
Myron Stowe <myron.stowe@...hat.com>,
Joe Lawrence <Joe.Lawrence@...atus.com>
Subject: Re: pcie aspm link setup, grandparent instead of parent?
[+cc linux-pci, Myron, Joe]
On Wed, Jun 12, 2013 at 11:21 AM, Radim Krčmář <rkrcmar@...hat.com> wrote:
> Hello,
>
> as a consequence of hitting a NULL dereference bug[1] while downstream
> aspm is setting up link_state, I started to wonder why is the code
> skipping its parent bus in favour of grandparent's link_state.[2]
>
> Is this right? (I have no device to test on ...)
>
> Thanks.
>
> ---
> 1: https://bugzilla.redhat.com/show_bug.cgi?id=972381
> The bug is hit because "pdev->bus->parent" has NULL "->parent" and thus
> NULL "->self".
> 2: "pdev = bus->self", so "pdev->bus->parent == bus->parent->parent"
>
>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 403a443..d58e282 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -527,7 +527,7 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
> link->pdev = pdev;
> if (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM) {
> struct pcie_link_state *parent;
> - parent = pdev->bus->parent->self->link_state;
> + parent = pdev->bus->self->link_state;
> if (!parent) {
> kfree(link);
> return NULL;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists