linux-stable/drivers/net
Brian Norris 1ec4c78e34 mwifiex: resolve reset vs. remove()/shutdown() deadlocks
commit a64e7a79dd upstream.

Commit b014e96d1a ("PCI: Protect pci_error_handlers->reset_notify()
usage with device_lock()") resolves races between driver reset and
removal, but it introduces some new deadlock problems. If we see a
timeout while we've already started suspending, removing, or shutting
down the driver, we might see:

(a) a worker thread, running mwifiex_pcie_work() ->
    mwifiex_pcie_card_reset_work() -> pci_reset_function()
(b) a removal thread, running mwifiex_pcie_remove() ->
    mwifiex_free_adapter() -> mwifiex_unregister() ->
    mwifiex_cleanup_pcie() -> cancel_work_sync(&card->work)

Unfortunately, mwifiex_pcie_remove() already holds the device lock that
pci_reset_function() is now requesting, and so we see a deadlock.

It's necessary to cancel and synchronize our outstanding work before
tearing down the driver, so we can't have this work wait indefinitely
for the lock.

It's reasonable to only "try" to reset here, since this will mostly
happen for cases where it's already difficult to reset the firmware
anyway (e.g., while we're suspending or powering off the system). And if
reset *really* needs to happen, we can always try again later.

Fixes: b014e96d1a ("PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()")
Cc: <stable@vger.kernel.org>
Cc: Xinming Hu <huxm@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:42:16 +01:00
..
appletalk License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arcnet License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bonding bonding: fix slave stuck in BOND_LINK_FAIL state 2017-11-08 16:07:10 +09:00
caif License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
can can: peak: fix potential bug in packet fragmentation 2018-01-23 19:58:17 +01:00
cris License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dsa net: dsa: bcm_sf2: Clear IDDQ_GLOBAL_PWR bit for PHY 2018-01-02 20:31:10 +01:00
ethernet IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports 2018-02-22 15:42:14 +01:00
fddi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fjes
hamradio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hippi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hyperv hv_netvsc: fix send buffer failure on MTU change 2017-09-21 15:17:16 -07:00
ieee802154 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ipvlan ipvlan: fix ipv6 outbound device 2017-12-17 15:08:00 +01:00
phy net: phy: marvell10g: fix the PHY id mask 2018-02-03 17:39:09 +01:00
plip
ppp ppp: unlock all_ppp_mutex before registering device 2018-01-31 14:03:46 +01:00
slip License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
team License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usb qmi_wwan: Add support for Quectel EP06 2018-02-13 10:19:47 +01:00
vmxnet3 vmxnet3: repair memory leak 2018-01-31 14:03:49 +01:00
wan License cleanup: add SPDX license identifiers to some files 2017-11-02 10:04:46 -07:00
wimax License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
wireless mwifiex: resolve reset vs. remove()/shutdown() deadlocks 2018-02-22 15:42:16 +01:00
xen-netback xen-netfront, xen-netback: Use correct minimum MTU values 2017-10-16 16:00:44 -04:00
dummy.c
eql.c
geneve.c geneve: fix fill_info when link down 2017-12-14 09:53:11 +01:00
gtp.c
ifb.c
Kconfig x86/lguest: Remove lguest support 2017-08-24 09:57:28 +02:00
LICENSE.SRC
loopback.c
macsec.c macsec: fix memory leaks when skb_to_sgvec fails 2017-10-11 14:07:20 -07:00
macvlan.c macvlan: Only deliver one copy of the frame to the macvlan interface 2017-12-20 10:10:36 +01:00
macvtap.c tap: reference to KVA of an unloaded module causes kernel panic 2017-10-28 19:17:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: accept UFO datagrams from tuntap and packet 2017-12-17 15:07:58 +01:00
tun.c tun: fix a memory leak for tfile->tx_array 2018-01-31 14:03:47 +01:00
veth.c
virtio_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-09-01 17:42:05 -07:00
vrf.c net: vrf: Add support for sends to local broadcast address 2018-01-31 14:03:45 +01:00
vsockmon.c
vxlan.c vxlan: restore dev->mtu setting based on lower device 2018-01-02 20:31:12 +01:00
xen-netfront.c xen-netfront: remove warning when unloading module 2018-02-03 17:39:07 +01:00