hack: suspend: redpine: use rsi_send_bgscan_params() in hw_scan_cancel
during transitioning to system suspend, we currently see "randomly" and "sometimes" this workqueue nullpoint deref which hangs the system:
[ 318.579976] OOM killer disabled.
[ 318.583221] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 318.594515] redpine_91x: <==== Interface DOWN ====>
[ 318.625240] redpine_91x: SDIO Bus suspend ===>
[ 318.629748] Unable to handle kernel NULL pointer dereference at virtual address 000000000000001b
<snip>
[ 318.695169] Modules linked in: <snip>
[ 318.803954] CPU: 2 PID: 1633 Comm: kworker/u8:11 <snip>
[ 318.814893] Hardware name: Purism Librem 5r4 (DT)
[ 318.819660] Workqueue: events_unbound async_run_entry_fn
[ 318.825147] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 318.832135] pc : redpine_mac80211_hw_scan_cancel+0x60/0x114 [redpine_91x]
[ 318.839165] lr : redpine_mac80211_hw_scan_cancel+0x50/0x114 [redpine_91x]
<snip>
[ 318.921141] Call trace:
[ 318.923629] redpine_mac80211_hw_scan_cancel+0x60/0x114 [redpine_91x]
[ 318.930139] rsi_suspend+0x6c/0x1d0 [redpine_sdio]
[ 318.935005] pm_generic_suspend+0x38/0x50
[ 318.939068] dpm_run_callback+0x60/0x1f0
[ 318.943012] __device_suspend+0x128/0x570
[ 318.947064] async_suspend+0x34/0xb0
[ 318.950680] async_run_entry_fn+0x40/0x150
[ 318.954813] process_one_work+0x204/0x480
[ 318.958892] worker_thread+0x154/0x450
[ 318.962685] kthread+0x118/0x120
[ 318.965966] ret_from_fork+0x10/0x20
[ 318.969609] Code: 52800020 390ee2c0 3969ea60 340000e0 (39406ee0)
[ 318.975776] ---[ end trace 0000000000000000 ]---
To work around this, use the piece of code that the mainline rsi driver uses in this function instead. This is a totally hacky workaround without a real solution in mind.
With this, the above error and hang don't happen anymore, but instead of this, (so only "sometimes") a kernel warning during resume:
WARNING: CPU: 1 PID: 1661 at net/mac80211/scan.c:433 __ieee80211_scan_completed+0x274/0x2d0 [mac80211]
that is not as critical, as wifi connection is preserved and userspace doesn't seem to notice anything.
Fixes #418 (closed)
Edited by Martin Kepplinger