Blame SOURCES/0001-linux-Fix-platform-device-PCI-detection-for-complex-.patch

3d8d92
From b6e18eb57f3dd104704d0a5ec3d2f051645b9068 Mon Sep 17 00:00:00 2001
3d8d92
From: Adam Jackson <ajax@redhat.com>
3d8d92
Date: Wed, 19 Jun 2019 14:23:56 -0400
3d8d92
Subject: [PATCH xserver] linux: Fix platform device PCI detection for complex
3d8d92
 bus topologies
3d8d92
3d8d92
Suppose you're in a Hyper-V guest and are trying to use PCI passthrough.
3d8d92
The ID_PATH that udev will construct for that looks something like
3d8d92
"acpi-VMBUS:00-pci-b8c8:00:00.0", and obviously looking for "pci-" in
3d8d92
the first four characters of that is going to not work.
3d8d92
3d8d92
Instead, strstr. I suppose it's possible you could have _multiple_ PCI
3d8d92
buses in the path, in which case you'd want strrstr, if that were a
3d8d92
thing.
3d8d92
---
3d8d92
 config/udev.c | 6 +++---
3d8d92
 1 file changed, 3 insertions(+), 3 deletions(-)
3d8d92
3d8d92
diff --git a/config/udev.c b/config/udev.c
3d8d92
index 314acba6ce..6e11aa3b88 100644
3d8d92
--- a/config/udev.c
3d8d92
+++ b/config/udev.c
3d8d92
@@ -474,7 +474,7 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
3d8d92
                                config_odev_probe_proc_ptr probe_callback)
3d8d92
 {
3d8d92
     struct OdevAttributes *attribs = config_odev_allocate_attributes();
3d8d92
-    const char *value;
3d8d92
+    const char *value, *str;
3d8d92
 
3d8d92
     attribs->path = XNFstrdup(path);
3d8d92
     attribs->syspath = XNFstrdup(syspath);
3d8d92
@@ -482,8 +482,8 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
3d8d92
     attribs->minor = minor;
3d8d92
 
3d8d92
     value = udev_device_get_property_value(udev_device, "ID_PATH");
3d8d92
-    if (value && !strncmp(value, "pci-", 4)) {
3d8d92
-        attribs->busid = XNFstrdup(value);
3d8d92
+    if (value && (str = strstr(value, "pci-"))) {
3d8d92
+        attribs->busid = XNFstrdup(str);
3d8d92
         attribs->busid[3] = ':';
3d8d92
     }
3d8d92
 
3d8d92
-- 
3d8d92
2.21.0
3d8d92