All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Engraf <david.engraf@sysgo.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: linux-pci@vger.kernel.org
Subject: Exception due to PCI: Use pci_is_root_bus() to check for root bus
Date: Wed, 6 Apr 2016 13:51:55 +0200	[thread overview]
Message-ID: <5704F85B.4080501@sysgo.com> (raw)

Hi,

I have an exception in __pci_bus_size_bridges() when pci_is_root_bus 
returns false but bus->self == NULL. My driver registers a virtual bus, 
like virtfn_add_bus(). pci_add_new_bus() is called with a parent but 
without a pci_dev. Thus bus->parent is set but bus->self is NULL. When 
__pci_bus_size_bridges() is called I get an exception at:

switch (bus->self->class >> 8)

The previous version of the code, checking for bus->self != NULL worked 
for me. I think an additional check is required to make sure we're not 
accessing a NULL pointer.

Best regards
David Engraf


             reply	other threads:[~2016-04-06 12:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 11:51 David Engraf [this message]
2016-04-06 13:35 ` Exception due to PCI: Use pci_is_root_bus() to check for root bus Bjorn Helgaas
2016-04-06 14:01   ` David Engraf
2016-04-25 13:04     ` [PATCH] " David Engraf
2016-04-25 16:59       ` Bjorn Helgaas
2016-05-11  7:04         ` David Engraf
2016-05-11 14:53           ` Bjorn Helgaas

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=5704F85B.4080501@sysgo.com \
    --to=david.engraf@sysgo.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=weiyang@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.