linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv4 0/2] PCI: Safe VPD access
@ 2015-12-18  8:35 Hannes Reinecke
  2015-12-18  8:35 ` [PATCH 1/2] pci: Update VPD definitions Hannes Reinecke
  2015-12-18  8:35 ` [PATCH 2/2] pci: Update VPD size with correct length Hannes Reinecke
  0 siblings, 2 replies; 16+ messages in thread
From: Hannes Reinecke @ 2015-12-18  8:35 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexander Duyck, Michal Kubecek, Shane M. Seymour, linux-pci,
	linux-kernel, Hannes Reinecke

PCI VPD suffers from two problems: it has a very rudimentary interface
and it relies on correctly formatted data. And essentially it provides
a direct channel into the card hardware. In other words, plenty of
chances to mess things up.
With the original implementation we would just read the VPD space,
blissfully ignorant of the data formatting of the VPD data. This
would work if the VPD space happens to be properly implemented.
However, I've had several reports where a simple 'cat' on the vpd
attribute would return garbage (if you're lucky), trigger a timeout
with a kernel warning (which actually triggered this patchset), or
hang your machine (if you're really unlucky).
So this patchset validates the VPD data, setting the VPD attribute to
the correct size or disabling VPD access altogether if no valid data
is found.

Changes to v3:
- Do not calculate size for pci function devices
- Do not disable the attribute on error
- move size calculation into the pci_vpd_ops structure

Hannes Reinecke (2):
  pci: Update VPD definitions
  pci: Update VPD size with correct length

 drivers/pci/access.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pci.h    |  1 +
 include/linux/pci.h  | 27 ++++++++++++++++--
 3 files changed, 107 insertions(+), 2 deletions(-)

-- 
1.8.5.6


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCHv3 0/2] PCI: Safe VPD access
@ 2015-12-17  7:59 Hannes Reinecke
  2015-12-17  7:59 ` [PATCH 2/2] pci: Update VPD size with correct length Hannes Reinecke
  0 siblings, 1 reply; 16+ messages in thread
From: Hannes Reinecke @ 2015-12-17  7:59 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexander Duyck, Michal Kubecek, Shane M. Seymour, linux-pci,
	linux-kernel, Hannes Reinecke

PCI VPD suffers from two problems: it has a very rudimentary interface
and it relies on correctly formatted data. And essentially it provides
a direct channel into the card hardware. In other words, plenty of
chances to mess things up.
With the original implementation we would just read the VPD space,
blissfully ignorant of the data formatting of the VPD data. This
would work if the VPD space happens to be properly implemented.
However, I've had several reports where a simple 'cat' on the vpd
attribute would return garbage (if you're lucky), trigger a timeout
with a kernel warning (which actually triggered this patchset), or
hang your machine (if you're really unlucky).
So this patchset validates the VPD data, setting the VPD attribute to
the correct size or disabling VPD access altogether if no valid data
is found.

Hannes Reinecke (2):
  pci: Update VPD definitions
  pci: Update VPD size with correct length

 drivers/pci/access.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h  | 27 +++++++++++++++++++++++--
 2 files changed, 82 insertions(+), 2 deletions(-)

-- 
1.8.5.6


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-12-29 20:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  8:35 [PATCHv4 0/2] PCI: Safe VPD access Hannes Reinecke
2015-12-18  8:35 ` [PATCH 1/2] pci: Update VPD definitions Hannes Reinecke
2015-12-18  8:35 ` [PATCH 2/2] pci: Update VPD size with correct length Hannes Reinecke
2015-12-18 13:49   ` Alexander Duyck
2015-12-18 13:57     ` Hannes Reinecke
2015-12-18 14:02       ` Alexander Duyck
2015-12-18 14:14         ` Hannes Reinecke
2015-12-29  5:29           ` Jordan_Hargrave
2015-12-29 17:48             ` Alexander Duyck
2015-12-29 19:01               ` Jordan_Hargrave
2015-12-29 20:26                 ` Alexander Duyck
  -- strict thread matches above, loose matches on Subject: below --
2015-12-17  7:59 [PATCHv3 0/2] PCI: Safe VPD access Hannes Reinecke
2015-12-17  7:59 ` [PATCH 2/2] pci: Update VPD size with correct length Hannes Reinecke
2015-12-17 11:06   ` Seymour, Shane M
2015-12-17 11:10   ` kbuild test robot
2015-12-17 17:13   ` Alexander Duyck
2015-12-18  7:44     ` Hannes Reinecke

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).