]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI / PCI: Fix NULL pointer dereference in acpi_get_pci_dev() (rev. 2)
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 12 Oct 2009 23:01:57 +0000 (01:01 +0200)
committerLen Brown <len.brown@intel.com>
Tue, 13 Oct 2009 05:14:53 +0000 (01:14 -0400)
commitc6be00d221a234d0c94f1c8b7d65282e2d7da46f
tree02531a0c69b41fa37ffa6f374d7ba81a7c90aedb
parent77f011e468b3aa9e5b781c5dd64b166cf38a1976
ACPI / PCI: Fix NULL pointer dereference in acpi_get_pci_dev() (rev. 2)

acpi_get_pci_dev() may be called for a non-PCI device, in which case
it should return NULL.  However, it assumes that every handle it
finds in the ACPI CA name space, between given device handle and the
PCI root bridge handle, corresponds to a PCI-to-PCI bridge with an
existing secondary bus.  For this reason, when it finds a struct
pci_dev object corresponding to one of them, it doesn't check if
its 'subordinate' field is a valid pointer.  This obviously leads to
a NULL pointer dereference if acpi_get_pci_dev() is called for a
non-PCI device with a PCI parent which is not a bridge.

To fix this issue make acpi_get_pci_dev() check if pdev->subordinate
is not NULL for every device it finds on the path between the root
bridge and the device it's supposed to get to and return NULL if the
"target" device cannot be found.

http://bugzilla.kernel.org/show_bug.cgi?id=14129
(worked in 2.6.30, regression in 2.6.31)

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Danny Feng <dfeng@redhat.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
Tested-by: chepioq <chepioq@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/pci_root.c