Skip to content

pci-hyperv: fix memory leak and add pci_destroy_slot()

Dexuan Cui linux-hyperv linux-pci lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PCI: hv: Fix a memory leak in hv_eject_device_work()drivers/pci/controller/pci-hyperv.c+3 -06 replies
2/3PCI: hv: Add hv_pci_remove_slots() when we unload the driverdrivers/pci/controller/pci-hyperv.c+16 -01 reply
3/3PCI: hv: Add pci_destroy_slot() in pci_devices_present_work(), if necessarydrivers/pci/controller/pci-hyperv.c+4 -06 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchStephen HemmingerMichael Kelley
SeriesR-b
1/3R-b
2/3A-b R-b
3/3R-b

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

Read the v1 thread

Cover letter [PATCH 0/3] pci-hyperv: fix memory leak and add pci_destroy_slot()

Patch #1 fixes a memory leak caused by incorrectly-maintained hpdev->refs.

Patch #2 and #3 make sure the "slot" is removed in all the scenarios. Without them, in the quick hot-add/hot-remove test, systemd-dev may easily crash when trying to access a dangling sys file in /sys/bus/pci/slots/:
"BUG: unable to handle kernel paging request".

BTW, Patch #2 was posted on Feb 7, 2019, and this is the v2: the change to hv_eject_device_work() in v1 is removed, as the change is only needed when we hot-remove the device and remove the pci-hyperv driver at the same time. It looks more work is required to make this scenaro work correctly, and since removing the driver is not really a "usual" usage, we can address this scenario in the future.

Please review the patchset.

Dexuan Cui (3):
PCI: hv: Fix a memory leak in hv_eject_device_work()
PCI: hv: Add hv_pci_remove_slots() when we unload the driver
PCI: hv: Add pci_destroy_slot() in pci_devices_present_work(), if
necessary

 drivers/pci/controller/pci-hyperv.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Signature · 1 line
2.19.1