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

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