From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
Linux PCI development list <linux-pci@vger.kernel.org>,
Myron Stowe <myron.stowe@redhat.com>,
Joe Lawrence <Joe.Lawrence@stratus.com>
Subject: Re: pcie aspm link setup, grandparent instead of parent?
Date: Thu, 13 Jun 2013 12:09:17 +0200 [thread overview]
Message-ID: <20130613100917.GA14089@hpx.cz> (raw)
In-Reply-To: <CAErSpo5XvTHFf+ZO0GAxKm0xk+fo9Hm_G6Ebz1UmMkLUi8CPyw@mail.gmail.com>
2013-06-12 15:54-0600, Bjorn Helgaas:
> [+cc linux-pci, Myron, Joe]
I'll remember it.
> On Wed, Jun 12, 2013 at 11:21 AM, Radim Krčmář <rkrcmar@redhat.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 ...)
No,
pcie_link_state covers both upstream and downstream port, so we skip
upstream port of current device.
Must the "parent device" (grandparent) have valid "->self"?
(qemu allows even topologies without the upstream port, so it does not
count for much ...)
> > 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;
prev parent reply other threads:[~2013-06-13 10:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 17:21 Radim Krčmář
2013-06-12 21:54 ` Bjorn Helgaas
2013-06-13 10:09 ` Radim Krčmář [this message]
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=20130613100917.GA14089@hpx.cz \
--to=rkrcmar@redhat.com \
--cc=Joe.Lawrence@stratus.com \
--cc=bhelgaas@google.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=myron.stowe@redhat.com \
/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
all inboxes | Powered by JetHome®