PCI: Add domain number check to find_smbios_instance_string()
authorSujith Pandel <sujithpshankar@gmail.com>
Tue, 2 May 2017 10:55:40 +0000 (06:55 -0400)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 13 Jun 2017 16:44:23 +0000 (11:44 -0500)
The function find_smbios_instance_string() does not consider the
PCI domain number.  As a result, SMBIOS type 41 device type instance
would be exported to sysfs for all the PCI domains which have a
PCI device with same bus/device/function, though PCI bus/device/func
from a specific PCI domain has SMBIOS type 41 device type instance
defined.

Address the issue by making find_smbios_instance_string() check PCI domain
number as well.

Reported-by: Shai Fultheim <Shai@ScaleMP.com>
Suggested-by: Shai Fultheim <Shai@ScaleMP.com>
Tested-by: Shai Fultheim <Shai@ScaleMP.com>
Signed-off-by: Sujith Pandel <sujithpshankar@gmail.com>
Signed-off-by: Narendra K <Narendra_K@Dell.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-label.c

index 51357377efbce65d4ad8454ffd678fc4df8de7a2..1d828a614ac0c515b158272f7b1ce2d0489231fd 100644 (file)
@@ -43,9 +43,11 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
 {
        const struct dmi_device *dmi;
        struct dmi_dev_onboard *donboard;
+       int domain_nr;
        int bus;
        int devfn;
 
+       domain_nr = pci_domain_nr(pdev->bus);
        bus = pdev->bus->number;
        devfn = pdev->devfn;
 
@@ -53,8 +55,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,
        while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
                                      NULL, dmi)) != NULL) {
                donboard = dmi->device_data;
-               if (donboard && donboard->bus == bus &&
-                                       donboard->devfn == devfn) {
+               if (donboard && donboard->segment == domain_nr &&
+                               donboard->bus == bus &&
+                               donboard->devfn == devfn) {
                        if (buf) {
                                if (attribute == SMBIOS_ATTR_INSTANCE_SHOW)
                                        return scnprintf(buf, PAGE_SIZE,