From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0094.outbound.protection.outlook.com ([104.47.33.94]:21055 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933222AbeDIAjs (ORCPT ); Sun, 8 Apr 2018 20:39:48 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Sujith Pandel , Narendra K , Bjorn Helgaas , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 025/101] PCI: Add domain number check to find_smbios_instance_string() Date: Mon, 9 Apr 2018 00:35:35 +0000 Message-ID: <20180409003505.164715-25-alexander.levin@microsoft.com> References: <20180409003505.164715-1-alexander.levin@microsoft.com> In-Reply-To: <20180409003505.164715-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Sujith Pandel [ 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 Suggested-by: Shai Fultheim Tested-by: Shai Fultheim Signed-off-by: Sujith Pandel Signed-off-by: Narendra K Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- 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 2ab1b47c7651..2ded1394b51e 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c @@ -45,9 +45,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; =20 + domain_nr =3D pci_domain_nr(pdev->bus); bus =3D pdev->bus->number; devfn =3D pdev->devfn; =20 @@ -55,8 +57,9 @@ static size_t find_smbios_instance_string(struct pci_dev = *pdev, char *buf, while ((dmi =3D dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, NULL, dmi)) !=3D NULL) { donboard =3D dmi->device_data; - if (donboard && donboard->bus =3D=3D bus && - donboard->devfn =3D=3D devfn) { + if (donboard && donboard->segment =3D=3D domain_nr && + donboard->bus =3D=3D bus && + donboard->devfn =3D=3D devfn) { if (buf) { if (attribute =3D=3D SMBIOS_ATTR_INSTANCE_SHOW) return scnprintf(buf, PAGE_SIZE, --=20 2.15.1