xorg-server: fix segfault probing non-PCI platform device on a system with PCI

Backported-from: e50c85f4ebf559a3bac4817b41074c43d4691779
Fix: #24739
This commit is contained in:
Đoàn Trần Công Danh 2020-09-17 08:03:24 +07:00
parent 3b3dc95fb7
commit fdbf1993cb

View file

@ -0,0 +1,31 @@
From e50c85f4ebf559a3bac4817b41074c43d4691779 Mon Sep 17 00:00:00 2001
From: Eric Anholt <eric@anholt.net>
Date: Fri, 26 Oct 2018 17:47:30 -0700
Subject: [PATCH] Fix segfault on probing a non-PCI platform device on a system
with PCI.
Some Broadcom set-top-box boards have PCI busses, but the GPU is still
probed through DT. We would dereference a null busid here in that
case.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
hw/xfree86/common/xf86platformBus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git hw/xfree86/common/xf86platformBus.c hw/xfree86/common/xf86platformBus.c
index cef47da03d..dadbac6c8f 100644
--- hw/xfree86/common/xf86platformBus.c
+++ hw/xfree86/common/xf86platformBus.c
@@ -289,7 +289,7 @@ xf86platformProbe(void)
for (i = 0; i < xf86_num_platform_devices; i++) {
char *busid = xf86_platform_odev_attributes(i)->busid;
- if (pci && (strncmp(busid, "pci:", 4) == 0)) {
+ if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) {
platform_find_pci_info(&xf86_platform_devices[i], busid);
}
--
GitLab