linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix NULL ptr dereference in pci_bus_assign_domain_nr() on ARM
@ 2016-03-01  6:07 Krzysztof Hałasa
  2016-03-03 17:35 ` Bjorn Helgaas
  2016-03-07 22:33 ` Bjorn Helgaas
  0 siblings, 2 replies; 9+ messages in thread
From: Krzysztof Hałasa @ 2016-03-01  6:07 UTC (permalink / raw)
  To: linux-arm-kernel

Many ARM platforms use a wrapper:
/*
 * Compatibility wrapper for older platforms that do not care about
 * passing the parent device.
 */
static inline void pci_common_init(struct hw_pci *hw)
{
        pci_common_init_dev(NULL, hw);
}

which means that pci_bus_assign_domain_nr() can be called without
a parent. This patch fixes the NULL pointer dereference.

Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>
Cc: stable at vger.kernel.org

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 602eb42..f89db3a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4772,8 +4772,10 @@ int pci_get_new_domain_nr(void)
 void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
 {
 	static int use_dt_domains = -1;
-	int domain = of_get_pci_domain_nr(parent->of_node);
+	int domain = -1;
 
+	if (parent)
+		domain = of_get_pci_domain_nr(parent->of_node);
 	/*
 	 * Check DT domain and use_dt_domains values.
 	 *

-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

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

end of thread, other threads:[~2016-03-08 10:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01  6:07 [PATCH] Fix NULL ptr dereference in pci_bus_assign_domain_nr() on ARM Krzysztof Hałasa
2016-03-03 17:35 ` Bjorn Helgaas
2016-03-04  6:13   ` Krzysztof Hałasa
2016-03-04 16:27     ` Bjorn Helgaas
2016-03-07 13:54       ` Krzysztof Hałasa
2016-03-07 22:33 ` Bjorn Helgaas
2016-03-08  3:01   ` Lorenzo Pieralisi
2016-03-08  4:24     ` Bjorn Helgaas
2016-03-08 10:49       ` Lorenzo Pieralisi

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