From: Bjorn Helgaas <bhelgaas@google.com>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-pci@vger.kernel.org,
Jordan Hargrave <Jordan_Hargrave@dell.com>,
Babu Moger <babu.moger@oracle.com>,
Alexander Duyck <alexander.duyck@gmail.com>
Subject: [PATCH v4 05/11] FIXME need bugzilla link
Date: Mon, 22 Feb 2016 18:47:00 -0600 [thread overview]
Message-ID: <20160223004700.10635.41496.stgit@bhelgaas-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20160223003444.10635.20204.stgit@bhelgaas-glaptop2.roam.corp.google.com>
From: Babu Moger <babu.moger@oracle.com>
PCI: Prevent VPD access for buggy devices
On some devices, reading or writing VPD data causes a system panic.
This can be easily reproduced by running "lspci -vvv" or
"cat /sys/bus/devices/XX../vpd".
Blacklist these devices so we don't access VPD data at all.
[bhelgaas: changelog, comment, drop pci/access.c changes]
Signed-off-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>
---
drivers/pci/quirks.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0575a1e..626c3b2 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2135,6 +2135,35 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching);
/*
+ * If a device follows the VPD format spec, the PCI core will not read or
+ * write past the VPD End Tag. But some vendors do not follow the VPD
+ * format spec, so we can't tell how much data is safe to access. Devices
+ * may behave unpredictably if we access too much. Blacklist these devices
+ * so we don't touch VPD at all.
+ */
+static void quirk_blacklist_vpd(struct pci_dev *dev)
+{
+ if (dev->vpd) {
+ dev->vpd->len = 0;
+ dev_warn(&dev->dev, FW_BUG "VPD access disabled\n");
+ }
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0413, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0078, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0079, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0073, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0071, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005b, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x002f, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
+ quirk_blacklist_vpd);
+
+/*
* For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
* VPD end tag will hang the device. This problem was initially
* observed when a vpd entry was created in sysfs
next prev parent reply other threads:[~2016-02-23 0:47 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 0:46 [PATCH v4 00/11] PCI VPD access fixes Bjorn Helgaas
2016-02-23 0:46 ` [PATCH v4 01/11] PCI: Update VPD definitions Bjorn Helgaas
2016-02-23 0:46 ` [PATCH v4 02/11] PCI: Allow access to VPD attributes with size 0 Bjorn Helgaas
2016-02-23 0:46 ` [PATCH v4 03/11] PCI: Use bitfield instead of bool for struct pci_vpd_pci22.busy Bjorn Helgaas
2016-02-23 12:19 ` Hannes Reinecke
2016-02-23 0:46 ` [PATCH v4 04/11] PCI: Determine actual VPD size on first access Bjorn Helgaas
2016-02-23 0:47 ` Bjorn Helgaas [this message]
2016-02-23 0:47 ` [PATCH v4 06/11] PCI: Move pci_read_vpd() and pci_write_vpd() close to other VPD code Bjorn Helgaas
2016-02-23 12:20 ` Hannes Reinecke
2016-02-23 0:47 ` [PATCH v4 07/11] PCI: Move pci_vpd_release() from header file to pci/access.c Bjorn Helgaas
2016-02-23 12:21 ` Hannes Reinecke
2016-02-23 0:47 ` [PATCH v4 08/11] PCI: Remove struct pci_vpd_ops.release function pointer Bjorn Helgaas
2016-02-23 12:22 ` Hannes Reinecke
2016-02-23 0:47 ` [PATCH v4 09/11] PCI: Rename VPD symbols to remove unnecessary "pci22" Bjorn Helgaas
2016-02-23 12:23 ` Hannes Reinecke
2016-02-23 0:47 ` [PATCH v4 10/11] PCI: Fold struct pci_vpd_pci22 into struct pci_vpd Bjorn Helgaas
2016-02-23 12:24 ` Hannes Reinecke
2016-02-23 0:47 ` [PATCH v4 11/11] PCI: Sleep rather than busy-wait for VPD access completion Bjorn Helgaas
2016-02-23 12:25 ` Hannes Reinecke
2016-02-23 14:07 ` [PATCH v4 00/11] PCI VPD access fixes Bjorn Helgaas
2016-02-23 21:48 ` Hannes Reinecke
2016-02-23 22:36 ` Bjorn Helgaas
2016-02-24 0:30 ` Hannes Reinecke
2016-02-24 0:45 ` Bjorn Helgaas
2016-02-23 17:11 ` Bjorn Helgaas
2016-02-24 4:52 ` Seymour, Shane M
2016-02-29 22:36 ` Babu Moger
2016-02-29 17:27 ` Babu Moger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160223004700.10635.41496.stgit@bhelgaas-glaptop2.roam.corp.google.com \
--to=bhelgaas@google.com \
--cc=Jordan_Hargrave@dell.com \
--cc=alexander.duyck@gmail.com \
--cc=babu.moger@oracle.com \
--cc=hare@suse.de \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).