From: khalasa@piap.pl (Krzysztof Hałasa)
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: [PATCH] Fix NULL ptr dereference in pci_bus_assign_domain_nr() on ARM
Date: Tue, 01 Mar 2016 07:07:18 +0100 [thread overview]
Message-ID: <m337sapw89.fsf@t19.piap.pl> (raw)
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@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
next reply other threads:[~2016-03-01 6:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 6:07 Krzysztof Hałasa [this message]
2016-03-03 17:35 ` [PATCH] Fix NULL ptr dereference in pci_bus_assign_domain_nr() on ARM 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
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=m337sapw89.fsf@t19.piap.pl \
--to=khalasa@piap.pl \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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