1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net/wireless
Abhishek Kumar b72a4aff94 ath10k: skip ath10k_halt during suspend for driver state RESTARTING
Double free crash is observed when FW recovery(caused by wmi
timeout/crash) is followed by immediate suspend event. The FW recovery
is triggered by ath10k_core_restart() which calls driver clean up via
ath10k_halt(). When the suspend event occurs between the FW recovery,
the restart worker thread is put into frozen state until suspend completes.
The suspend event triggers ath10k_stop() which again triggers ath10k_halt()
The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be
called twice(Note: ath10k_htt_rx_alloc was not called by restart worker
thread because of its frozen state), causing the crash.

To fix this, during the suspend flow, skip call to ath10k_halt() in
ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING.
Also, for driver state ATH10K_STATE_RESTARTING, call
ath10k_wait_for_suspend() in ath10k_stop(). This is because call to
ath10k_wait_for_suspend() is skipped later in
[ath10k_halt() > ath10k_core_stop()] for the driver state
ATH10K_STATE_RESTARTING.

The frozen restart worker thread will be cancelled during resume when the
device comes out of suspend.

Below is the crash stack for reference:

[  428.469167] ------------[ cut here ]------------
[  428.469180] kernel BUG at mm/slub.c:4150!
[  428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[  428.469219] Workqueue: events_unbound async_run_entry_fn
[  428.469230] RIP: 0010:kfree+0x319/0x31b
[  428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246
[  428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000
[  428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000
[  428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000
[  428.469276] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  428.469285] Call Trace:
[  428.469295]  ? dma_free_attrs+0x5f/0x7d
[  428.469320]  ath10k_core_stop+0x5b/0x6f
[  428.469336]  ath10k_halt+0x126/0x177
[  428.469352]  ath10k_stop+0x41/0x7e
[  428.469387]  drv_stop+0x88/0x10e
[  428.469410]  __ieee80211_suspend+0x297/0x411
[  428.469441]  rdev_suspend+0x6e/0xd0
[  428.469462]  wiphy_suspend+0xb1/0x105
[  428.469483]  ? name_show+0x2d/0x2d
[  428.469490]  dpm_run_callback+0x8c/0x126
[  428.469511]  ? name_show+0x2d/0x2d
[  428.469517]  __device_suspend+0x2e7/0x41b
[  428.469523]  async_suspend+0x1f/0x93
[  428.469529]  async_run_entry_fn+0x3d/0xd1
[  428.469535]  process_one_work+0x1b1/0x329
[  428.469541]  worker_thread+0x213/0x372
[  428.469547]  kthread+0x150/0x15f
[  428.469552]  ? pr_cont_work+0x58/0x58
[  428.469558]  ? kthread_blkcg+0x31/0x31

Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
Co-developed-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Abhishek Kumar <kuabhs@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220426221859.v2.1.I650b809482e1af8d0156ed88b5dc2677a0711d46@changeid
2022-04-29 09:06:16 +03:00
..
admtek module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ath ath10k: skip ath10k_halt during suspend for driver state RESTARTING 2022-04-29 09:06:16 +03:00
atmel atmel: use eth_hw_addr_set() 2021-10-20 12:39:44 +03:00
broadcom brcmfmac: p2p: Fix spelling mistake "Comback" -> "Comeback" 2022-03-17 16:16:36 +02:00
cisco airo: fix typos in comments 2022-03-16 17:30:40 +02:00
intel iwlwifi: mei: Replace zero-length array with flexible-array member 2022-04-06 10:19:08 +03:00
intersil spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
marvell mwifiex: make read-only array wmm_oui static const 2022-03-16 17:28:01 +02:00
mediatek mt76: fix monitor rx FCS error in DFS channel 2022-03-16 21:18:06 +01:00
microchip spi: Make remove() return void 2022-02-28 10:43:07 -08:00
quantenna wireless: use eth_hw_addr_set() instead of ether_addr_copy() 2021-10-20 12:39:42 +03:00
ralink rt2x00: do not mark device gone on EPROTO errors during start 2021-11-29 12:53:50 +02:00
realtek rtw89: handle potential uninitialized variable 2022-04-06 10:50:03 +03:00
rsi Merge branch 'signal-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2022-01-17 05:49:30 +02:00
st brcmfmac 2022-03-11 13:00:17 -08:00
ti spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
zydas zd1201: use kzalloc 2022-03-16 17:28:40 +02:00
Kconfig wireless: remove CONFIG_WIRELESS_WDS 2020-11-10 09:39:08 +01:00
mac80211_hwsim.c brcmfmac 2022-03-11 13:00:17 -08:00
mac80211_hwsim.h
Makefile
ray_cs.c ray_cs: Check ioremap return value 2022-02-01 14:24:35 +02:00
ray_cs.h
rayctl.h
rndis_wlan.c wireless: Remove redundant 'flush_workqueue()' calls 2021-10-13 09:22:19 +03:00
virt_wifi.c virt_wifi: fix error on connect 2021-07-23 10:34:31 +02:00
wl3501.h wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join 2021-04-22 17:38:41 +03:00
wl3501_cs.c wl3501_cs: use eth_hw_addr_set() 2021-10-20 12:39:47 +03:00