From: Babu Moger <babu.moger@oracle.com>
To: Bjorn Helgaas <helgaas@kernel.org>, Hannes Reinecke <hare@suse.de>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 4/4] pci: Blacklist vpd access for buggy devices
Date: Tue, 9 Feb 2016 15:24:10 -0600 [thread overview]
Message-ID: <56BA58FA.40600@oracle.com> (raw)
In-Reply-To: <20160209210759.GC32530@localhost>
On 2/9/2016 3:07 PM, Bjorn Helgaas wrote:
> There seem to be several revs of this patch, and it's hard for me to
> keep track of what's current. If you want to update any patch in the
> series, please repost the entire series with a new version number.
Here is the latest of patch 4/4.
https://patchwork.kernel.org/patch/8084221/
I will wait for Hannes's response before re-posting it.
Hannes, If you want me to re-post all the series let me know.
>
> On Wed, Jan 13, 2016 at 12:25:35PM +0100, Hannes Reinecke wrote:
>> From: Babu Moger <babu.moger@oracle.com>
>>
>> Reading or Writing of PCI VPD data causes system panic.
>> We saw this problem by running "lspci -vvv" in the beginning.
>> However this can be easily reproduced by running
>> cat /sys/bus/devices/XX../vpd
>>
>> As even a simple read on any VPD data triggers a system
>> lockup on certain cards this patch implements a PCI quirk
>> to disabling VPD acces altogether by setting the vpd length
>
> s/acces/access/
> s/vpd/VPD/
>
>> to '0'.
>>
>> Signed-off-by: Babu Moger <babu.moger@oracle.com>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>> drivers/pci/access.c | 5 ++++-
>> drivers/pci/quirks.c | 41 +++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 45 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
>> index 914e023..82f41a8 100644
>> --- a/drivers/pci/access.c
>> +++ b/drivers/pci/access.c
>> @@ -396,7 +396,7 @@ static ssize_t pci_vpd_pci22_read(struct pci_dev *dev, loff_t pos, size_t count,
>> if (pos < 0)
>> return -EINVAL;
>>
>> - if (!vpd->valid) {
>> + if (!vpd->valid && vpd->base.len > 0) {
>> vpd->valid = true;
>> vpd->base.len = pci_vpd_pci22_size(dev);
>> }
>> @@ -459,6 +459,9 @@ static ssize_t pci_vpd_pci22_write(struct pci_dev *dev, loff_t pos, size_t count
>> loff_t end = pos + count;
>> int ret = 0;
>>
>> + if (vpd->base.len == 0)
>> + return -EIO;
>> +
>> if (!vpd->valid)
>> return -EAGAIN;
>>
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 7e32730..af0f8a1 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -2123,6 +2123,47 @@ 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);
>>
>> /*
>> + * A read/write to sysfs entry ('/sys/bus/pci/devices/<id>/vpd')
>> + * will dump 32k of data. The default length is set as 32768.
>> + * Reading a full 32k will cause an access beyond the VPD end tag.
>> + * The system behaviour at that point is mostly unpredictable.
>> + * Apparently, some vendors have not implemented this VPD headers properly.
>> + * Adding a generic function disable vpd data for these buggy adapters
>> + * Add the DECLARE_PCI_FIXUP_FINAL line below with the specific with
>> + * vendor and device of interest to use this quirk.
>> + */
>> +static void quirk_blacklist_vpd(struct pci_dev *dev)
>> +{
>> + if (dev->vpd) {
>> + dev->vpd->len = 0;
>> + dev_warn(&dev->dev, "PCI vpd access has been disabled due to firmware bug\n");
>
> "PCI" is superfluous and "VPD" should be capitalized.
>
>> + }
>> +}
>> +
>> +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);
>> +
>> +/*
>> * 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
>> --
>> 1.8.5.6
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-02-09 21:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 11:25 [PATCHv2 0/4] PCI VPD access fixes Hannes Reinecke
2016-01-13 11:25 ` [PATCHv2 1/4] pci: Update VPD definitions Hannes Reinecke
2016-01-13 11:25 ` [PATCHv2 2/4] pci: allow access to VPD attributes with size '0' Hannes Reinecke
2016-02-09 20:53 ` Bjorn Helgaas
2016-02-10 7:17 ` Hannes Reinecke
2016-01-13 11:25 ` [PATCHv2 3/4] pci: Determine actual VPD size on first access Hannes Reinecke
2016-02-09 21:04 ` Bjorn Helgaas
2016-02-10 7:24 ` Hannes Reinecke
2016-08-09 12:54 ` Alexey Kardashevskiy
2016-08-09 18:12 ` Alexander Duyck
2016-08-10 0:03 ` Benjamin Herrenschmidt
2016-08-10 15:47 ` Alexander Duyck
2016-08-10 23:54 ` Benjamin Herrenschmidt
2016-08-11 18:52 ` Alexander Duyck
2016-08-11 20:17 ` Alex Williamson
2016-08-12 5:11 ` Benjamin Herrenschmidt
2016-08-15 17:59 ` Rustad, Mark D
2016-08-15 22:23 ` Benjamin Herrenschmidt
2016-08-15 22:33 ` Benjamin Herrenschmidt
2016-08-15 23:16 ` Rustad, Mark D
2016-08-16 0:13 ` Benjamin Herrenschmidt
2016-08-16 1:40 ` Alexey Kardashevskiy
2016-08-10 6:23 ` Hannes Reinecke
2016-08-11 10:03 ` [RFC PATCH kernel] PCI: Enable access to custom VPD for Chelsio devices (cxgb3) Alexey Kardashevskiy
2016-09-06 15:48 ` Bjorn Helgaas
2016-09-06 18:30 ` Alexander Duyck
2016-09-21 10:53 ` Alexey Kardashevskiy
2016-08-09 23:59 ` [PATCHv2 3/4] pci: Determine actual VPD size on first access Benjamin Herrenschmidt
2016-01-13 11:25 ` [PATCHv2 4/4] pci: Blacklist vpd access for buggy devices Hannes Reinecke
2016-01-19 20:57 ` [PATCH v3 " Babu Moger
2016-02-09 21:07 ` [PATCHv2 " Bjorn Helgaas
2016-02-09 21:24 ` Babu Moger [this message]
2016-01-15 1:07 ` [PATCHv2 0/4] PCI VPD access fixes Seymour, Shane M
2016-01-15 14:10 ` Babu Moger
2016-01-15 14:18 ` Hannes Reinecke
2016-01-19 20:53 ` Babu Moger
2016-01-21 18:34 ` [PATCH v4 4/4] pci: Blacklist vpd access for buggy devices 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=56BA58FA.40600@oracle.com \
--to=babu.moger@oracle.com \
--cc=alexander.duyck@gmail.com \
--cc=hare@suse.de \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).