Skip to content

PCI: Safe VPD access

Hannes Reinecke linux-pci lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 8 repliesIn review
  2. v32 patches 4 repliesSuperseded

Changes to v3 from the cover letter

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

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2pci: Update VPD definitionsinclude/linux/pci.h+25 -20 replies
2/2pci: Update VPD size with correct lengthdrivers/pci/access.c drivers/pci/pci.h+82 -08 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCHv4 0/2] PCI: Safe VPD access

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(-)
Signature · 1 line
1.8.5.6