summaryrefslogtreecommitdiff
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
authorTroy Moure <twmoure@szypr.net>2009-06-25 17:05:35 -0600
committerLen Brown <len.brown@intel.com>2009-06-26 00:23:42 -0400
commit412af97838828bc6d035a1902c8974f944663da6 (patch)
treef50b1de9aa3ab2c4ae7db0bf4afeb7f1cc6b2163 /drivers/acpi/pci_root.c
parent3cd530b5aaffd27b231f9717730f2f6684c00bda (diff)
downloadlwn-412af97838828bc6d035a1902c8974f944663da6.tar.gz
lwn-412af97838828bc6d035a1902c8974f944663da6.zip
ACPI: video: prevent NULL deref in acpi_get_pci_dev()
ref: http://thread.gmane.org/gmane.linux.kernel/857228/focus=857468 When the ACPI video driver initializes, it does a namespace walk looking for for supported devices. When we find an appropriate handle, we walk up the ACPI tree looking for a PCI root bus, and then walk back down the PCI bus, assuming that every device inbetween is a P2P bridge. This assumption is not correct, and is reported broken on at least: Dell Latitude E6400 ThinkPad X61 Dell XPS M1330 Add a NULL deref check to prevent boot panics. Reported-by: Alessandro Suardi <alessandro.suardi@gmail.com> Signed-off-by: Troy Moure <twmoure@szypr.net> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 8a5bf3b356fa..55b5b90c2a44 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -395,7 +395,7 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
fn = adr & 0xffff;
pdev = pci_get_slot(pbus, PCI_DEVFN(dev, fn));
- if (hnd == handle)
+ if (!pdev || hnd == handle)
break;
pbus = pdev->subordinate;