]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: fix upstream P2P bridge checks when enabling OBFF and LTR
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 19 Jun 2012 13:35:34 +0000 (07:35 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 20 Jun 2012 23:28:53 +0000 (17:28 -0600)
commit9df3e272b53b6cbc33ede5e101577e5d79a27db7
tree111ffade25983b6c92dc8b2dc8634f2ed978a533
parent4caf8c6fd3ac806d1dc2b165f93cd1eb29227f47
PCI: fix upstream P2P bridge checks when enabling OBFF and LTR

pci_enable_obff() and pci_enable_ltr() incorrectly check "dev->bus" instead
of "dev->bus->self" to determine whether the upstream device is a P2P
bridge or a host bridge.  For devices on the root bus, the upstream device
is a host bridge, "dev->bus != NULL" and "dev->bus->self == NULL", and we
panic with a null pointer dereference.

These functions should previously have panicked when called on devices
supporting OBFF or LTR, so they should be regarded as untested.

Found by Coverity (CID 143038 and CID 143039).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c