linux/drivers/pci
Niklas Schnelle f86ca2b553 s390/pci: Prevent self deletion in disable_slot()
commit 47c3978448 upstream.

As disable_slot() takes a struct zpci_dev from the Configured to the
Standby state. In Standby there is still a hotplug slot so this is not
usually a case of sysfs self deletion. This is important because self
deletion gets very hairy in terms of locking (see for example
recover_store() in arch/s390/pci/pci_sysfs.c).

Because the pci_dev_put() is not within the critical section of the
zdev->state_lock however, disable_slot() can turn into a case of self
deletion if zPCI device event handling slips between the mutex_unlock()
and the pci_dev_put(). If the latter is the last put and
zpci_release_device() is called this then tries to remove the hotplug
slot via zpci_exit_slot() which will try to remove the hotplug slot
directory the disable_slot() is part of i.e. self deletion.

Prevent this by widening the zdev->state_lock critical section to
include the pci_dev_put() which is then guaranteed to happen with the
struct zpci_dev still in Standby state ensuring it will not lead to
a zpci_release_device() call as at least the zPCI event handling code
still holds a reference.

Cc: stable@vger.kernel.org
Fixes: a46044a92a ("s390/pci: fix zpci_zdev_put() on reserve")
Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
Tested-by: Gerd Bayer <gbayer@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-06-27 11:11:14 +01:00
..
controller PCI: apple: Use gpiod_set_value_cansleep in probe flow 2025-06-19 15:32:10 +02:00
endpoint PCI: endpoint: Retain fixed-size BAR size as well as aligned size 2025-06-19 15:32:11 +02:00
hotplug s390/pci: Prevent self deletion in disable_slot() 2025-06-27 11:11:14 +01:00
msi PCI/MSI: Add an option to write MSIX ENTRY_DATA before any reads 2025-05-02 07:58:56 +02:00
pcie PCI/DPC: Log Error Source ID only when valid 2025-06-19 15:32:10 +02:00
pwrctl PCI/pwrctl: Abandon QCom WCN probe on pre-pwrseq device-trees 2024-10-23 13:34:41 -05:00
switch PCI: switchtec: Add Microchip PCI100X device IDs 2025-02-21 14:01:24 +01:00
access.c PCI: Revert the cfg_access_lock lockdep mechanism 2024-06-04 12:10:05 -05:00
ats.c iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability 2025-05-29 11:02:04 +02:00
bus.c pci-v6.11-changes 2024-07-19 19:03:18 -07:00
devres.c PCI: Fix wrong length of devres array 2025-04-20 10:15:58 +02:00
doe.c PCI/DOE: Support discovery version 2 2024-04-09 09:33:15 -05:00
ecam.c PCI: Dynamically map ECAM regions 2021-06-16 17:20:40 -05:00
host-bridge.c PCI: VMD: ACPI: Make ACPI companion lookup work for VMD bus 2021-09-02 17:59:58 +02:00
iomap.c PCI: Check BAR index for validity 2025-04-20 10:15:26 +02:00
iov.c PCI: Use resource names in PCI log messages 2023-12-15 17:28:42 -06:00
irq.c PCI: Place interrupt related code into irq.c 2024-01-29 17:01:31 -06:00
Kconfig x86/kaslr: Reduce KASLR entropy on most x86 systems 2025-05-29 11:02:40 +02:00
Makefile PCI/NPEM: Add Native PCIe Enclosure Management support 2024-09-04 17:25:12 -05:00
mmap.c PCI/sysfs: Compile pci-sysfs.c only if CONFIG_SYSFS=y 2024-03-05 16:08:43 -06:00
npem.c PCI/NPEM: Add _DSM PCIe SSD status LED management 2024-09-06 11:37:24 -05:00
of.c pci-v6.11-changes 2024-07-19 19:03:18 -07:00
of_property.c PCI: of_property: Assign PCI instead of CPU bus address to dynamic PCI nodes 2024-12-09 10:41:09 +01:00
p2pdma.c PCI/P2PDMA: Fix a sleeping issue in a RCU read section 2024-02-08 15:31:43 -06:00
pci-acpi.c PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root() 2025-06-19 15:32:10 +02:00
pci-bridge-emul.c PCI: Rename CRS Completion Status to RRS 2024-09-10 19:52:30 -05:00
pci-bridge-emul.h PCI: pci-bridge-emul: Set position of PCI capabilities to real HW value 2022-08-25 12:07:56 +02:00
pci-driver.c PCI: Make pci_bus_type constant 2024-08-23 12:46:22 -05:00
pci-label.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
pci-mid.c PCI/PM: Switch to new Intel CPU model defines 2024-06-11 17:08:14 -05:00
pci-pf-stub.c PCI: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:35:35 +00:00
pci-stub.c PCI: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:35:35 +00:00
pci-sysfs.c PCI: Fix BAR resizing when VF BARs are assigned 2025-04-10 14:39:16 +02:00
pci.c PCI: Print the actual delay time in pci_bridge_wait_for_secondary_bus() 2025-06-19 15:32:09 +02:00
pci.h PCI: Check BAR index for validity 2025-04-20 10:15:26 +02:00
probe.c PCI: Fix reference leak in pci_register_host_bridge() 2025-04-20 10:15:58 +02:00
proc.c PCI: Remove pci_mmap_page_range() wrapper 2022-07-29 12:08:44 -05:00
quirks.c PCI: Avoid FLR for Mediatek MT7922 WiFi 2025-02-21 14:01:34 +01:00
remove.c pci-v6.12-changes 2024-09-23 12:47:06 -07:00
rom.c PCI: Prefer 'unsigned int' over bare 'unsigned' 2021-10-27 13:41:22 -05:00
search.c PCI: Add pci_get_base_class() helper 2023-09-28 16:49:44 -05:00
setup-bus.c PCI: Fix old_size lower bound in calculate_iosize() too 2025-05-29 11:02:46 +02:00
setup-res.c PCI: Use resource names in PCI log messages 2023-12-15 17:28:42 -06:00
slot.c PCI: Fix use-after-free of slot->bus on hot remove 2024-12-05 14:02:45 +01:00
syscall.c PCI: Use consistent put_user() pointer types 2023-08-25 08:15:13 -05:00
vc.c PCI/VC: Use FIELD_GET() 2023-10-24 16:55:45 -05:00
vgaarb.c pci-v6.7-changes 2023-11-02 14:05:18 -10:00
vpd.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
xen-pcifront.c x86: always initialize xen-swiotlb when xen-pcifront is enabling 2023-07-31 17:54:27 +02:00