Commit 30376394 authored by Povilas Kanapickas's avatar Povilas Kanapickas
Browse files

xfree86: Consistently check for reference to primaryBus pci_device

This is the only place where we don't check whether
primaryBus.id.plat->pdev is not NULL before accessing its members.

It may be NULL in cases we fail to parse the busid in
config_udev_odev_setup_attribs() (see also [1], [2]) such as when udev
does not give use ID_PATH. This in turn leads to
platform_find_pci_info() being not called and pdev being NULL in one of
the items within the xf86_platform_devices array. For this to cause a
crash we only need it to become the primaryBus device.

[1]: #993
[2]: #1076

Signed-off-by: Povilas Kanapickas's avatarPovilas Kanapickas <povilas@radix.lt>
parent b9722d39
......@@ -296,7 +296,8 @@ xf86IsEntityPrimary(int entityIndex)
#ifdef XSERVER_LIBPCIACCESS
if (primaryBus.type == BUS_PLATFORM && pEnt->bus.type == BUS_PCI)
return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev);
if (primaryBus.id.plat->pdev)
return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev);
#endif
if (primaryBus.type != pEnt->bus.type)
......
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