linux-stable/drivers/pci/host
Dexuan Cui 5661d43b03 PCI: hv: Serialize the present and eject work items
commit 021ad274d7 upstream.

When we hot-remove the device, we first receive a PCI_EJECT message and
then receive a PCI_BUS_RELATIONS message with bus_rel->device_count == 0.

The first message is offloaded to hv_eject_device_work(), and the second
is offloaded to pci_devices_present_work(). Both the paths can be running
list_del(&hpdev->list_entry), causing general protection fault, because
system_wq can run them concurrently.

The patch eliminates the race condition.

Since access to present/eject work items is serialized, we do not need the
hbus->enum_sem anymore, so remove it.

Fixes: 4daace0d8c ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
Link: https://lkml.kernel.org/r/KL1P15301MB00064DA6B4D221123B5241CFBFD70@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM
Tested-by: Adrian Suhov <v-adsuho@microsoft.com>
Tested-by: Chris Valean <v-chvale@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
[lorenzo.pieralisi@arm.com: squashed semaphore removal patch]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Cc: <stable@vger.kernel.org> # v4.6+
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jack Morgenstein <jackm@mellanox.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-19 08:56:17 +02:00
..
Kconfig Merge branch 'pci/host-xilinx' into next 2017-09-07 13:24:11 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-aardvark.c PCI: aardvark: Move to struct pci_host_bridge IRQ mapping functions 2017-10-10 21:17:43 -05:00
pci-ftpci100.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-host-common.c PCI: generic: Drop pci_fixup_irqs() 2017-07-02 16:51:19 -05:00
pci-host-generic.c PCI: Don't allow unbinding host controllers that aren't prepared 2017-04-28 10:38:00 -05:00
pci-hyperv.c PCI: hv: Serialize the present and eject work items 2018-04-19 08:56:17 +02:00
pci-mvebu.c Merge branch 'pci/misc' into next 2017-09-07 13:24:16 -05:00
pci-rcar-gen2.c PCI: rcar-gen2: Make of_device_ids const 2017-07-02 18:45:31 -05:00
pci-tegra.c Revert "PCI: tegra: Do not allocate MSI target memory" 2017-10-10 19:06:16 -05:00
pci-thunder-ecam.c PCI: Don't allow unbinding host controllers that aren't prepared 2017-04-28 10:38:00 -05:00
pci-thunder-pem.c PCI: Don't allow unbinding host controllers that aren't prepared 2017-04-28 10:38:00 -05:00
pci-versatile.c PCI: versatile: Add local struct device pointers 2017-07-02 18:46:43 -05:00
pci-xgene-msi.c PCI: xgene: Fix platform_get_irq() error handling 2017-09-07 08:52:42 -05:00
pci-xgene.c PCI: xgene: Clean up whitespace 2017-09-07 08:52:43 -05:00
pcie-altera-msi.c PCI: altera: Fix platform_get_irq() error handling 2017-09-05 13:36:28 -05:00
pcie-altera.c PCI: altera: Fix platform_get_irq() error handling 2017-09-05 13:36:28 -05:00
pcie-iproc-bcma.c PCI: iproc: Convert PCI scan API to pci_scan_root_bus_bridge() 2017-07-02 16:14:24 -05:00
pcie-iproc-msi.c PCI: iproc: Remove unused struct iproc_pcie *pcie 2017-07-31 14:32:47 -05:00
pcie-iproc-platform.c PCI: iproc: Fix NULL pointer dereference for BCMA 2018-02-22 15:42:27 +01:00
pcie-iproc.c PCI: iproc: Fix NULL pointer dereference for BCMA 2018-02-22 15:42:27 +01:00
pcie-iproc.h PCI: iproc: Fix NULL pointer dereference for BCMA 2018-02-22 15:42:27 +01:00
pcie-mediatek.c PCI: mediatek: Use PCI_NUM_INTX 2017-08-30 08:23:59 -05:00
pcie-rcar.c PCI: rcar: Handle rcar_pcie_parse_request_of_pci_ranges() failures 2018-03-24 11:01:26 +01:00
pcie-rockchip.c Merge branch 'pci/trivial' into next 2017-09-07 13:24:20 -05:00
pcie-tango.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcie-xilinx-nwl.c PCI: xilinx-nwl: Fix platform_get_irq() error handling 2017-09-05 13:41:13 -05:00
pcie-xilinx.c Merge branch 'pci/trivial' into next 2017-09-07 13:24:20 -05:00
vmd.c PCI: vmd: Remove IRQ affinity so we can allocate more IRQs 2017-08-30 16:18:38 -05:00