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

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