Skip to content

PCI: s390: Fix user-after-free and clean up

Niklas Schnelle linux-pci linux-s390 lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 9 repliesIn review
  2. v1 posting 2/21 patch 9 repliesSuperseded
  3. v1 posting 1/21 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- Added clean up patches inspired by Bjorn's questions
- Removed return at end of function returning void

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4PCI: s390: Fix use-after-free of PCI resources with per-function hotplugarch/s390/pci/pci.c arch/s390/pci/pci_bus.c arch/s390/pci/pci_bus.h +2 more+38 -156 replies
2/4s390/pci: only add specific device in zpci_bus_scan_device()arch/s390/pci/pci_bus.c+1 -21 reply
3/4s390/pci: remove redundant pci_bus_add_devices() on new busarch/s390/pci/pci_bus.c+0 -11 reply
4/4s390/pci: clean up left over special treatment for function zeroarch/s390/pci/pci.c+3 -201 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchBjorn HelgaasMatthew Rosato
1/4A-b R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] PCI: s390: Fix user-after-free and clean up

Hi Bjorn, Hi Lukas,

This is v2 of my fix for a use-after-free of PCI MMIO resources in the s390 PCI layer. As Bjorn found some redundant pci_bus_add_device() uses and function zero special treatment I've added 3 cleanup patches in addition to the fix itself. These are independent but in my opinion make it easier to see the struct zpci_dev interactions with the common PCI code. If you prefer I can of course split them off. As discussed this version still uses the pci_rescan_remove lock to allow backporting but I'll be looking into adding a more specific resource lock as a follow up.

Thanks,
Niklas

Changes since v1:
- Added clean up patches inspired by Bjorn's questions
- Removed return at end of function returning void

Niklas Schnelle (4):
PCI: s390: Fix use-after-free of PCI resources with per-function
hotplug
s390/pci: only add specific device in zpci_bus_scan_device() s390/pci: remove redundant pci_bus_add_devices() on new bus s390/pci: clean up left over special treatment for function zero

 arch/s390/pci/pci.c     | 39 +++++++++++++--------------------------
 arch/s390/pci/pci_bus.c | 16 ++++++----------
 arch/s390/pci/pci_bus.h |  3 +--
 drivers/pci/bus.c       | 21 +++++++++++++++++++++
 include/linux/pci.h     |  1 +
 5 files changed, 42 insertions(+), 38 deletions(-)
Signature · 1 line
2.37.2