linux-stable/drivers/pci
Logan Gunthorpe 12ce9fd7fc PCI/switchtec: Fix init_completion race condition with poll_wait()
[ Upstream commit efbdc76960 ]

The call to init_completion() in mrpc_queue_cmd() can theoretically
race with the call to poll_wait() in switchtec_dev_poll().

  poll()			write()
    switchtec_dev_poll()   	  switchtec_dev_write()
      poll_wait(&s->comp.wait);      mrpc_queue_cmd()
			               init_completion(&s->comp)
				         init_waitqueue_head(&s->comp.wait)

To my knowledge, no one has hit this bug.

Fix this by using reinit_completion() instead of init_completion() in
mrpc_queue_cmd().

Fixes: 080b47def5 ("MicroSemi Switchtec management interface driver")

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lkml.kernel.org/r/20200313183608.2646-1-logang@deltatee.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-17 10:48:40 +02:00
..
controller PCI: iproc: Apply quirk_paxc_bridge() for module as well as built-in 2020-02-24 08:34:41 +01:00
endpoint PCI: endpoint: functions: Use memcpy_fromio()/memcpy_toio() 2020-01-27 14:50:23 +01:00
hotplug PCI: rpaphp: Correctly match ibm, my-drc-index to drc-name when using drc-info 2020-01-04 19:12:55 +01:00
pcie PCI/PTM: Remove spurious "d" from granularity message 2020-01-17 19:47:08 +01:00
switch PCI/switchtec: Fix init_completion race condition with poll_wait() 2020-04-17 10:48:40 +02:00
access.c
ats.c
bus.c
ecam.c
host-bridge.c
iov.c PCI/IOV: Fix memory leak in pci_iov_add_virtfn() 2020-02-14 16:33:23 -05:00
irq.c
Kconfig
Makefile
mmap.c
msi.c PCI/MSI: Fix incorrect MSI-X masking on resume 2019-12-21 10:57:24 +01:00
of.c
pci-acpi.c ACPI/PCI: PM: Add missing wakeup.flags.valid checks 2019-06-22 08:15:17 +02:00
pci-driver.c PM: ACPI/PCI: Resume all devices during hibernation 2020-01-27 14:50:59 +01:00
pci-label.c
pci-mid.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
pci-pf-stub.c
pci-stub.c
pci-sysfs.c PCI: sysfs: Ignore lockdep for remove attribute 2019-07-31 07:27:02 +02:00
pci.c PCI: Fix "try" semantics of bus and slot reset 2020-01-27 14:50:30 +01:00
pci.h PCI/ERR: Use slot reset if available 2019-11-20 18:47:13 +01:00
probe.c PCI: Init PCIe feature bits for managed host bridge alloc 2019-05-25 18:23:37 +02:00
proc.c
quirks.c PCI: Increase D3 delay for AMD Ryzen5/7 XHCI controllers 2020-02-24 08:34:41 +01:00
remove.c
rom.c
search.c
setup-bus.c PCI: Don't disable bridge BARs when assigning bus resources 2020-02-14 16:33:23 -05:00
setup-irq.c
setup-res.c
slot.c PCI/ERR: Use slot reset if available 2019-11-20 18:47:13 +01:00
syscall.c
vc.c
vpd.c
xen-pcifront.c