Commit cb4cb4ac authored by Alex Chiang's avatar Alex Chiang Committed by Matthew Wilcox

PCIe: AER: during disable, check subordinate before walking

Commit 47a8b0cc (Enable PCIe AER only after checking firmware
support) wants to walk the PCI bus in the remove path to disable
AER, and calls pci_walk_bus for downstream bridges.

Unfortunately, in the remove path, we remove devices and bridges
in a depth-first manner, starting with the furthest downstream
bridge and working our way backwards.

The furthest downstream bridges will not have a dev->subordinate,
and we hit a NULL deref in pci_walk_bus.

Check for dev->subordinate first before attempting to walk the
PCI hierarchy below us.
Acked-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
parent 649426ef
...@@ -133,6 +133,9 @@ static void set_downstream_devices_error_reporting(struct pci_dev *dev, ...@@ -133,6 +133,9 @@ static void set_downstream_devices_error_reporting(struct pci_dev *dev,
bool enable) bool enable)
{ {
set_device_error_reporting(dev, &enable); set_device_error_reporting(dev, &enable);
if (!dev->subordinate)
return;
pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable); pci_walk_bus(dev->subordinate, set_device_error_reporting, &enable);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment