aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2022-01-10 22:12:53 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2022-01-16 22:39:28 +0000
commit82a6a8c2941ac7819b90c841484ed6a155e2a459 (patch)
tree3d24f730858ec42c8580236425881c4cdb9fd6fe
parentd12ea01e39eaa099c1f9fede29e7bf01a9259259 (diff)
downloadsrc-82a6a8c2941ac7819b90c841484ed6a155e2a459.tar.gz
src-82a6a8c2941ac7819b90c841484ed6a155e2a459.zip
LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()
In lkpi_stop_hw_scan() we have to unlock around cancelling the hardware scan and an msleep to wait for the confirmation that the scan ended. Otherwise we are sleeping with the non-sleepable net80211 com lock held. At the same time we need to hold the lhw lock for the msleep(). This lock change got lost in the refactoring of lkpi_iv_newstate(). Reported by: ambrisko, delphij PR: 261075 Sponsored by: The FreeBSD Foundation (cherry picked from commit bec766282f242aab3a4bfba402ea74cb0ccf96fb)
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 8515152d66a6..ff58d715ac65 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -573,11 +573,15 @@ lkpi_stop_hw_scan(struct lkpi_hw *lhw, struct ieee80211_vif *vif)
hw = LHW_TO_HW(lhw);
+ IEEE80211_UNLOCK(lhw->ic);
+ LKPI_80211_LHW_LOCK(lhw);
/* Need to cancel the scan. */
lkpi_80211_mo_cancel_hw_scan(hw, vif);
/* Need to make sure we see ieee80211_scan_completed. */
error = msleep(lhw, &lhw->mtx, 0, "lhwscanstop", hz/2);
+ LKPI_80211_LHW_UNLOCK(lhw);
+ IEEE80211_LOCK(lhw->ic);
if ((lhw->scan_flags & LKPI_SCAN_RUNNING) != 0)
ic_printf(lhw->ic, "%s: failed to cancel scan: %d (%p, %p)\n",