Skip to content

Commit

Permalink
ACPI: video: prevent NULL deref in acpi_get_pci_dev()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Troy Moure authored and Len Brown committed Jun 26, 2009
1 parent 3cd530b commit 412af97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 412af97

Please sign in to comment.