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
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Bjoern A. Zeeb 2022-01-10 22:12:53 +00:00
parent d0ff9b029c
commit bec766282f

View file

@ -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",