[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180409002239.163177-57-alexander.levin@microsoft.com>
Date: Mon, 9 Apr 2018 00:23:35 +0000
From: Sasha Levin <Alexander.Levin@...rosoft.com>
To: "stable@...r.kernel.org" <stable@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Sujith Pandel <sujithpshankar@...il.com>,
Narendra K <Narendra_K@...l.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Sasha Levin <Alexander.Levin@...rosoft.com>
Subject: [PATCH AUTOSEL for 4.9 057/293] PCI: Add domain number check to
find_smbios_instance_string()
From: Sujith Pandel <sujithpshankar@...il.com>
[ Upstream commit 6c51c82c60991bdbfb937f3bf0cdbe68d042073d ]
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@...leMP.com>
Suggested-by: Shai Fultheim <Shai@...leMP.com>
Tested-by: Shai Fultheim <Shai@...leMP.com>
Signed-off-by: Sujith Pandel <sujithpshankar@...il.com>
Signed-off-by: Narendra K <Narendra_K@...l.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
Signed-off-by: Sasha Levin <alexander.levin@...rosoft.com>
---
drivers/pci/pci-label.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index 51357377efbc..1d828a614ac0 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -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,
--
2.15.1
Powered by blists - more mailing lists