linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix __pci_bus_size_bridges when bridge is not available
@ 2016-05-12  6:56 David Engraf
  2016-06-13 20:28 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: David Engraf @ 2016-05-12  6:56 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Bjorn Helgaas, Wei Yang, linux-pci

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

A virtual PCI controller may not have a bridge device, thus when 
__pci_bus_size_bridges is called, it will generate a NULL pointer 
exception when accessing bus->self->class. The attached patch adds a 
check to verify if a bridge has been set. Without a bridge device, the 
function returns.

Signed-off-by: David Engraf <david.engraf <at> sysgo.com>


[-- Attachment #2: setup-pci.patch --]
[-- Type: text/x-diff, Size: 465 bytes --]

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 55641a3..ddb3381 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1245,6 +1245,10 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
 	if (pci_is_root_bus(bus))
 		return;
 
+	/* bridge device available? */
+	if (!bus->self)
+		return;
+
 	switch (bus->self->class >> 8) {
 	case PCI_CLASS_BRIDGE_CARDBUS:
 		/* don't size cardbuses yet. */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-13 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12  6:56 [PATCH] PCI: Fix __pci_bus_size_bridges when bridge is not available David Engraf
2016-06-13 20:28 ` Bjorn Helgaas

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).