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]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/993 [2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1076 Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
303763941f
commit
0d93bbfa2c
|
@ -365,10 +365,12 @@ xf86MergeOutputClassOptions(int entityIndex, void **options)
|
||||||
break;
|
break;
|
||||||
case BUS_PCI:
|
case BUS_PCI:
|
||||||
for (i = 0; i < xf86_num_platform_devices; i++) {
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
||||||
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
|
if (xf86_platform_devices[i].pdev) {
|
||||||
entity->bus.id.pci)) {
|
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
|
||||||
dev = &xf86_platform_devices[i];
|
entity->bus.id.pci)) {
|
||||||
break;
|
dev = &xf86_platform_devices[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -85,6 +85,9 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
|
||||||
bustype = StringToBusType(busid, &id);
|
bustype = StringToBusType(busid, &id);
|
||||||
if (bustype == BUS_PCI) {
|
if (bustype == BUS_PCI) {
|
||||||
struct pci_device *pPci = device->pdev;
|
struct pci_device *pPci = device->pdev;
|
||||||
|
if (!pPci)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (xf86ComparePciBusString(busid,
|
if (xf86ComparePciBusString(busid,
|
||||||
((pPci->domain << 8)
|
((pPci->domain << 8)
|
||||||
| pPci->bus),
|
| pPci->bus),
|
||||||
|
|
Loading…
Reference in New Issue