linux/drivers/net/wireless
Brian Norris a64e7a79dd mwifiex: resolve reset vs. remove()/shutdown() deadlocks
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>
2018-01-16 18:00:17 +02:00
..
admtek License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ath wireless-drivers-next patches for 4.16 2018-01-15 14:46:16 -05:00
atmel treewide: Switch DEFINE_TIMER callbacks to struct timer_list * 2017-11-21 15:57:05 -08:00
broadcom b43: Replace mdelay with usleep_range in b43_radio_2057_init_post 2018-01-11 21:54:01 +02:00
cisco License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
intel wireless-drivers-next patches for 4.16 2018-01-15 14:46:16 -05:00
intersil treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
marvell mwifiex: resolve reset vs. remove()/shutdown() deadlocks 2018-01-16 18:00:17 +02:00
mediatek mt76x2: eeprom: fix typo in mt76x2_get_power_info_5g() 2018-01-08 19:29:40 +02:00
quantenna qtnfmac: support MAC address based access control 2018-01-09 14:11:23 +02:00
ralink rt2x00: Fix a typo in printk 2018-01-08 19:41:22 +02:00
realtek rtlwifi: btcoexist: remove redundant variable fw_ps_state 2018-01-16 17:59:13 +02:00
rsi rsi: fix memory leak on buf and usb_reg_buf 2017-11-18 10:32:41 +09:00
st mac80211: use QoS NDP for AP probing 2017-11-27 11:23:20 +01:00
ti wl1251: check return from call to wl1251_acx_arp_ip_filter 2018-01-08 19:40:36 +02:00
zydas zd1201: remove unused variable framelen 2017-11-08 14:52:57 +02:00
Kconfig qtnfmac: introduce new FullMAC driver for Quantenna chipsets 2017-05-24 17:04:13 +03:00
mac80211_hwsim.c We have things all over the place, no point listing them. 2018-01-04 14:33:29 -05:00
mac80211_hwsim.h mac80211_hwsim: fix command documentation indentation 2017-03-06 09:21:48 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ray_cs.c treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts 2017-11-21 16:35:54 -08:00
ray_cs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rayctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rndis_wlan.c Another set of patches for -next: 2017-04-28 14:41:15 -04:00
wl3501_cs.c wl3501_cs: fix spelling mistake: "Insupported" -> "Unsupported" 2017-07-28 18:06:31 +03:00
wl3501.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00