Commit 0d93bbfa authored by Povilas Kanapickas's avatar Povilas Kanapickas
Browse files

xfree86: Fix potentially NULL reference to platform device's PCI device

xf86_platform_devices[i].pdev 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.

[1]: xorg/xserver#993
[2]: xorg/xserver#1076

Reviewed-by: Zoltán Böszörményi's avatarZoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Povilas Kanapickas's avatarPovilas Kanapickas <povilas@radix.lt>
parent 30376394
Pipeline #346603 passed with stages
in 7 minutes and 40 seconds
......@@ -365,12 +365,14 @@ xf86MergeOutputClassOptions(int entityIndex, void **options)
break;
case BUS_PCI:
for (i = 0; i < xf86_num_platform_devices; i++) {
if (xf86_platform_devices[i].pdev) {
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
entity->bus.id.pci)) {
dev = &xf86_platform_devices[i];
break;
}
}
}
break;
default:
xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
......
......@@ -85,6 +85,9 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
bustype = StringToBusType(busid, &id);
if (bustype == BUS_PCI) {
struct pci_device *pPci = device->pdev;
if (!pPci)
return FALSE;
if (xf86ComparePciBusString(busid,
((pPci->domain << 8)
| pPci->bus),
......
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